1 | 'use strict';
|
2 |
|
3 | const util = require('util');
|
4 |
|
5 | const Item = require('./item');
|
6 |
|
7 | const constants = require('constants');
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | function SymbolicLink() {
|
14 | Item.call(this);
|
15 |
|
16 | |
17 |
|
18 |
|
19 |
|
20 | this._path = undefined;
|
21 | }
|
22 | util.inherits(SymbolicLink, Item);
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | SymbolicLink.prototype.setPath = function(pathname) {
|
29 | this._path = pathname;
|
30 | };
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | SymbolicLink.prototype.getPath = function() {
|
37 | return this._path;
|
38 | };
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | SymbolicLink.prototype.getStats = function(bigint) {
|
45 | const size = this._path.length;
|
46 | const stats = Item.prototype.getStats.call(this, bigint);
|
47 | const convert = bigint ? v => BigInt(v) : v => v;
|
48 |
|
49 | stats[1] = convert(this.getMode() | constants.S_IFLNK);
|
50 | stats[8] = convert(size);
|
51 | stats[9] = convert(Math.ceil(size / 512));
|
52 |
|
53 | return stats;
|
54 | };
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | exports = module.exports = SymbolicLink;
|