| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1385ffc commit 61a56fe
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,18 @@ async function validateEmptyWrite() { | |||
| 35 | 35 | assert.deepStrictEqual(buffer, readFileData); | |
| 36 | 36 | } | |
| 37 | 37 | ||
| 38 | - validateWrite() | ||
| 39 | - .then(validateEmptyWrite) | ||
| 40 | - .then(common.mustCall()); | ||
| 38 | + async function validateNonUint8ArrayWrite() { | ||
| 39 | + const filePathForHandle = path.resolve(tmpDir, 'tmp-data-write.txt'); | ||
| 40 | + const fileHandle = await open(filePathForHandle, 'w+'); | ||
| 41 | + const buffer = Buffer.from('Hello world', 'utf8').toString('base64'); | ||
| 42 | + | ||
| 43 | + await fileHandle.write(buffer, 0, buffer.length); | ||
| 44 | + const readFileData = fs.readFileSync(filePathForHandle); | ||
| 45 | + assert.deepStrictEqual(Buffer.from(buffer, 'utf8'), readFileData); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + Promise.all([ | ||
| 49 | + validateWrite(), | ||
| 50 | + validateEmptyWrite(), | ||
| 51 | + validateNonUint8ArrayWrite() | ||
| 52 | + ]).then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments