1

This works perfectly in terminal.

curl -H "Authorization: Bearer sknWtK4sRtd...." "https://mypropect.api.sanity.io/v2021-06-07/data/export/myDataset" > exportedData.ndjson

How can I make this work with node? This doesn't save file or return error.

const { exec } = require('child_process');
    exec('curl -H "Authorization: Bearer sknWtK4sRt..." "https://myproject.api.sanity.io/v2021-06-07/data/export/mydataset" > mydataexported.ndjson');

I tried several solutions and curl libraries.

1
  • from where do you run the script, the file should be saved in process.cwd() location..
    – traynor
    Commented Feb 9 at 8:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.