summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/fstream/examples/symlink-write.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/fstream/examples/symlink-write.js')
-rw-r--r--deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/fstream/examples/symlink-write.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/fstream/examples/symlink-write.js b/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/fstream/examples/symlink-write.js
new file mode 100644
index 0000000000..19e81eea9f
--- /dev/null
+++ b/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/fstream/examples/symlink-write.js
@@ -0,0 +1,27 @@
+var fstream = require('../fstream.js')
+var notOpen = false
+process.chdir(__dirname)
+
+fstream
+ .Writer({
+ path: 'path/to/symlink',
+ linkpath: './file',
+ isSymbolicLink: true,
+ mode: '0755' // octal strings supported
+ })
+ .on('close', function () {
+ notOpen = true
+ var fs = require('fs')
+ var s = fs.lstatSync('path/to/symlink')
+ var isSym = s.isSymbolicLink()
+ console.log((isSym ? '' : 'not ') + 'ok 1 should be symlink')
+ var t = fs.readlinkSync('path/to/symlink')
+ var isTarget = t === './file'
+ console.log((isTarget ? '' : 'not ') + 'ok 2 should link to ./file')
+ })
+ .end()
+
+process.on('exit', function () {
+ console.log((notOpen ? '' : 'not ') + 'ok 3 should be closed')
+ console.log('1..3')
+})