A
A
akopartem2021-01-09 13:53:29
Node.js
akopartem, 2021-01-09 13:53:29

Can the content of a promise be written to a JSON file?

Let's say I have a promise. Can I import it in JSON file? If so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2021-01-09
@bingo347

const fs = require('fs');
promise.then(data => fs.promises.writeFile('/path/to/file', JSON.stringify(data)));

Why so many tags? Even npm was somehow dragged here ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question