import { createReadStream } from 'node:fs';
-import { writeFile, mkdir, open } from 'node:fs/promises';
+import { mkdir, open } from 'node:fs/promises';
import { dirname, normalize } from 'node:path';
import { Readable } from 'node:stream';
/** @import { PathLike } from 'node:fs' */
return new WritableStream({
async start() {
await mkdir(dir, { recursive: true });
- await writeFile(fullPath, '', { flush: true });
- handle = await open(fullPath, 'a');
+ handle = await open(fullPath, 'w');
},
async write(chunk) {
let data;
data = chunk;
}
await handle.write(data);
- await handle.sync();
},
async close() {
await handle.close();