1 | import {createWriteStream} from 'fs'
|
2 | import streamToPromise from 'stream-to-promise'
|
3 |
|
4 | export async function write (data, path) {
|
5 | const stream = createWriteStream(path)
|
6 | const promise = streamToPromise(stream)
|
7 | stream.end(data, 'utf8')
|
8 | return await promise
|
9 | }
|