[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[nodeJS] 042 File open/close (async)
"042-3 Opening & closing files with #open:flags:mode:with: #close:with:"
| fs closeBlock |
closeBlock := [:ex| self print:'042-3 Async close executed', ex ].
fs := NodeJS fs.
fs open: (TestPath, 'Sample.txt') flags:#r mode:0666 with: [:error :fd|
error isNil ifFalse: [ ^self error: '042-3 ' ,error ].
fs close: fd with: closeBlock.
].
"042-4 Opening & closing files with #open:flags:with: #close:with:"
| fs closeBlock |
closeBlock := [:ex| self print:'042-4 Async close executed', ex ].
fs := NodeJS fs.
fs open: (TestPath, 'Sample.txt') flags:#r with: [:error :fd|
error isNil ifFalse: [ ^self error: '042-4 ' ,error ].
fs close: fd with: closeBlock.
].