title: How to convert the following curl call to nodejs axios?
body: <pre><code>curl -F 'data=@./resourcesByFileId.png' -F 'props={&quot;title&quot;:&quot;resource title&quot;}' http://localhost:27583/resources
  </code></pre>
  <pre><code> async create(fd: FormData) {
      const resp = await axios.post&lt;ResourceGetRes&gt;(
        ApiUtil.baseUrl('/resources'),
        fd,
        {
          headers: fd.getHeaders(),
        },
      )
      return resp.data
    }
    
      const fd = new FormData()
      const path = resolve(__dirname, '../resource/resourcesByFileId.png')
      console.log('test create: ', path)
      fd.append('props', JSON.stringify({ title: '图片标题' }))
      fd.append('data', createReadStream(path))
      await resourceApi.create(fd)
  </code></pre>
  <p>I tried it with form-data and axios and it blew up</p>
  <p>Original question <a href="https://discourse.joplinapp.org/t/how-to-use-joplin-api-resources-id-file/11333/3?u=rxliuli" rel="nofollow noreferrer">https://discourse.joplinapp.org/t/how-to-use-joplin-api-resources-id-file/11333/3?u=rxliuli</a></p>
  <hr />
  <p>I tried fetch and it succeeded immediately. Is there any difference between the two below?</p>
  <pre><code>  describe('diff fetch and axios', () =&gt; {
      function getFormData() {
        const fd = new FormData()
        const path = resolve(__dirname, '../resource/resourcesByFileId.png')
        const title = 'image title'
        fd.append('props', JSON.stringify({ title: title }))
        fd.append('data', createReadStream(path))
        return fd
      }
  
      it('test create by fetch', async () =&gt; {
        const fd = getFormData()
        const resp = await fetch(ApiUtil.baseUrl('/resources'), {
          method: 'post',
          body: fd,
        })
        const json = await resp.json()
        console.log('json: ', json)
      })
      it.skip('test create by axios', async () =&gt; {
        const fd = getFormData()
        const resp = await axios.post(ApiUtil.baseUrl('/resources'), fd, {
          headers: fd.getHeaders(),
        })
        console.log('resp.data: ', resp.data)
      })
    })
  </code></pre>