Created
          August 2, 2020 11:20 
        
      - 
      
 - 
        
Save darwinsubramaniam/82df4694bcb5776e6a19455c2dfd0b96 to your computer and use it in GitHub Desktop.  
    sample in node js
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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