]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/fstream/examples/symlink-write.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / fstream / examples / symlink-write.js
1 var fstream = require('../fstream.js')
2 var notOpen = false
3 process.chdir(__dirname)
4
5 fstream
6   .Writer({
7     path: 'path/to/symlink',
8     linkpath: './file',
9     isSymbolicLink: true,
10     mode: '0755' // octal strings supported
11   })
12   .on('close', function () {
13     notOpen = true
14     var fs = require('fs')
15     var s = fs.lstatSync('path/to/symlink')
16     var isSym = s.isSymbolicLink()
17     console.log((isSym ? '' : 'not ') + 'ok 1 should be symlink')
18     var t = fs.readlinkSync('path/to/symlink')
19     var isTarget = t === './file'
20     console.log((isTarget ? '' : 'not ') + 'ok 2 should link to ./file')
21   })
22   .end()
23
24 process.on('exit', function () {
25   console.log((notOpen ? '' : 'not ') + 'ok 3 should be closed')
26   console.log('1..3')
27 })