repl.txt (1072B)
1 2 {{alias}}( fd, clbk ) 3 Asynchronously closes a file descriptor, so that the file descriptor no 4 longer refers to any file and may be reused. 5 6 Parameters 7 ---------- 8 fd: integer 9 File descriptor. 10 11 clbk: Function 12 Callback to invoke upon closing a file descriptor. 13 14 Examples 15 -------- 16 > function done( error ) { 17 ... if ( error ) { 18 ... console.error( error.message ); 19 ... } 20 ... }; 21 > var fd = {{alias:@stdlib/fs/open}}.sync( './beep/boop.js', 'r+' ); 22 > if ( !{{alias:@stdlib/assert/is-error}}( fd ) ) { {{alias}}( fd, done ); }; 23 24 25 {{alias}}.sync( fd ) 26 Synchronously closes a file descriptor. 27 28 Parameters 29 ---------- 30 fd: integer 31 File descriptor. 32 33 Returns 34 ------- 35 out: Error|void 36 If an error occurs, an error object; otherwise, undefined. 37 38 Examples 39 -------- 40 > var fd = {{alias:@stdlib/fs/open}}.sync( './beep/boop.js', 'r+' ); 41 > if ( !{{alias:@stdlib/assert/is-error}}( fd ) ) { {{alias}}.sync( fd ); }; 42 43 See Also 44 -------- 45