Skip to content

Instantly share code, notes, and snippets.

@omas-public
Last active December 19, 2022 09:58
Show Gist options
  • Save omas-public/be8817277f2216b0bf7b5284aeb925fd to your computer and use it in GitHub Desktop.
Save omas-public/be8817277f2216b0bf7b5284aeb925fd to your computer and use it in GitHub Desktop.
const fileSync = file => {
const stream = require('fs').readFileSync(file, 'utf8').trim()
console.log(stream)
return stream
}
const fileAsync = file => {
const callback = (error, data) => data
const stream = require('fs').readFile(file, 'utf8',
callback
)
return stream
}
// console.log('fileSync', fileSync('./data'))
// console.log('fileAsync', fileAsync('./data'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment