Skip to content

Instantly share code, notes, and snippets.

@darwinsubramaniam
Created August 2, 2020 11:20
Show Gist options
  • Save darwinsubramaniam/82df4694bcb5776e6a19455c2dfd0b96 to your computer and use it in GitHub Desktop.
Save darwinsubramaniam/82df4694bcb5776e6a19455c2dfd0b96 to your computer and use it in GitHub Desktop.
sample in node js
import { mkdir, open, writeFile} from 'fs/promises';
import { existsSync } from 'fs';
var dir = './asset';
async function start() {
if (!existsSync(dir)) {
await mkdir(dir);
}
process.chdir('./asset')
console.log(process.cwd())
await open('text.txt', 'w').catch(err => console.log(err));
const data = {
name: "Javascript Runtime Engine",
isMultiOS: true,
isOpenSource: true,
};
writeFile('data.json', JSON.stringify(data,null,2))
}
start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment