Created
August 27, 2019 03:19
-
-
Save tonghuikang/d99504e546f2e7963036d6b496bc181f to your computer and use it in GitHub Desktop.
Nodejs asynchronous read and write file
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 parser = require("azure-func-multipart-parser"); | |
var localImports = require("../modules/local-imports.js") | |
const FormData = require("form-data"); | |
const fs = require('fs') | |
const { promisify } = require('util') | |
const readFileAsync = promisify(fs.readFile) | |
const writeFileAsync = promisify(fs.writeFile) | |
const run = async () => { | |
await writeFileAsync("/tmp/test/data.json", Buffer.from('Hello Node.js')); | |
const res = await readFileAsync('/tmp/test/data.json'); | |
console.log(res) | |
} | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment