[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[nodeJS] 046 File Append (async)
"046-5 Writing files with #appendFile:data:options:with:"
| options |
options := ((#encoding -> #utf8),(#mode -> 0666),(#flag -> #a)).
NodeJS fs appendFile: (TestPath, 'Sample46-5.txt') data:'More S8 data.' options: options with: [:error |
error isNil ifFalse: [ ^self error: '046-5 ' ,error ].
].
"046-6 Writing files with #appendFile:data:options:with: v2"
| options jsObject data |
options := ((#encoding -> #utf8),(#mode -> 0666),(#flag -> #a)).
jsObject := {'new Buffer(13)'}.
data := NodeBuffer @ jsObject.
data write: 'More S8 data.'.
NodeJS fs appendFile: (TestPath, 'Sample46-6.txt') data: data options: options with: [:error |
(error isNil) ifFalse: [ ^self error: '046-6 ' ,error].
].
"046-7 Writing files with #appendFile:data:with:"
NodeJS fs appendFile: (TestPath, 'Sample46-7.txt') data:'More S8 data.' with: [:error |
(error isNil) ifFalse: [ ^self error: '046-7 ' ,error].
].
"046-8 Writing files with #appendFile:data:with: v2"
| data jsObject |
jsObject := {'new Buffer(13)'}.
data := (NodeBuffer @ jsObject).
data write:'More S8 data.'.
NodeJS fs appendFile: (TestPath, 'Sample46-8.txt') data: data with: [:error |
(error isNil) ifFalse: [ ^self error: '046-8 ' ,error].
].