You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
585 B

'use strict';
const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
common.refreshTmpDir();
// test creating and reading hard link
const srcPath = path.join(common.tmpDir, 'hardlink-target.txt');
const dstPath = path.join(common.tmpDir, 'link1.js');
fs.writeFileSync(srcPath, 'hello world');
const callback = function(err) {
if (err) throw err;
const dstContent = fs.readFileSync(dstPath, 'utf8');
assert.strictEqual('hello world', dstContent);
};
fs.link(srcPath, dstPath, common.mustCall(callback));