WriteFile.st 455 B

1234567891011121314151617181920212223242526
  1. Object subclass: #WriteFile
  2. instanceVariableNames: ''
  3. package: 'WriteFileExample'!
  4. !WriteFile class methodsFor: 'main'!
  5. main
  6. | fs |
  7. console log: 'Writing a file called "message.txt".'.
  8. "get access to the nodejs file system library"
  9. fs := require value: 'fs'.
  10. "use a fs api function http://nodejs.org/api/fs.html"
  11. fs writeFileSync: 'message.txt' content: 'This file was written by Amber.'
  12. errFn: nil.
  13. ! !