[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[nodeJS] 045 File Stat (async)
"045-4 Reading device info with #stat:with:"
NodeJS fs stat: (TestPath, 'Sample.txt') with: [:error :st| | stats |
(error isNil) ifFalse: [ ^self error: '045-4 ' ,error].
stats := NodeStats @ st.
"self print: '045-4 Sample.txt has ', stats size,' bytes'."
].
"045-5 Reading device info with #fstat:with:"
| fs stats |
fs := NodeJS fs.
fs open: (TestPath, 'Sample.txt') flags:#r with: [:error :fd|
error isNil ifFalse: [ ^self error: '045-5 ' ,error].
fs fstat: fd with:[:err :st|
err isNil ifFalse:[ ^self error:'045-5 ', err].
stats := NodeStats @ st.
"self print: '045-5 sample.txt has ', stats size,' bytes'."
fs closeSync: fd.
]
].
"045-6 Reading device info with #lstat:with:"
NodeJS fs lstat: (TestPath, 'Sample.txt') with: [:error :st| | stats |
(error isNil) ifFalse: [ ^self error: '045-6 ' ,error].
stats := NodeStats @ st.
"self print: '045-6 Sample.txt has ', stats size,' bytes'."
].