Last active
January 24, 2018 13:30
-
-
Save saschanaz/31b9a26871ea15057f7c42641a87ac1b to your computer and use it in GitHub Desktop.
macOS append mode test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
console.log(process.version); | |
var f = fs.openSync("testfile", "w"); | |
fs.writeSync(f, "a=1\nb=2\n"); | |
fs.closeSync(f); | |
f = fs.openSync("testfile", "a"); | |
fs.writeSync(f, new Uint8Array([99, 61, 51]), 0, 3, 8); | |
fs.closeSync(f); | |
var result = fs.readFileSync("testfile", { encoding: "utf-8" }); | |
var success = result === "a=1\nb=2\nc=3"; | |
console.log(result, success ? "success" : "failure"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment