Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
stats-ctor
Advanced tools
Readme
fs.Stats
constructor with a sane signature and defaults.
Sane defaults.
var Stats = require('stats-ctor');
var stat = new Stats();
console.log(stat.mode); // 0
console.log(stat.uid); // 1000 - from `process.getuid()`
console.log(stat.mtime); // 2018-03-29T17:01:48.883Z - from `new Date()`
Sane single argument signature.
var fs = require('fs');
var Stats = require('stats-ctor');
var umask = 0o002;
var stat = new Stats({
mode: fs.constats.S_IFREG | (umask ^ 0o777)
});
console.log(stat.mode); // 33277
Free copy constructor.
var fs = require('fs');
var Stats = require('stats-ctor');
var stat = fs.statSync('./README.md');
var copy = new Stats(stat);
console.log(stat === copy); // false
console.log(stat.mtime.getTime() === copy.mtime.getTime()); // true - same for all properties on the copy instance
Identical to the fs.Stats
constructor in node core, except it has a single
options argument instead of fourteen named arguments.
Type: Object
Simply uses the named arguments from fs.Stats
as property names.
Type: Number
Default: 0
Type: Number
Default: 0
You should create a real mode for most use cases. See fs.constants
. For example when creating a new regular file do fs.constants.S_IFREG | (process.umask() ^ 0o666)
.
Type: Number
Default: 0
Type: Number
Default: process.getuid()
Type: Number
Default: process.getgid()
Type: Number
Default: 0
Type: Number
Default: 0
Type: Number
Default: 0
Type: Number
Default: 0
Type: Number
Default: 0
Type: Number
Default: Date.now()
This property creates a Date
instance called atime
.
Type: Number
Default: Date.now()
This property creates a Date
instance called mtime
.
Type: Number
Default: Date.now()
This property creates a Date
instance called ctime
.
Type: Number
Default: Date.now()
This property creates a Date
instance called birthtime
.
Type: Number
A millisecond getter/setter for atime
.
If available on the instance, setter will update atimeMs
.
Type: Number
A millisecond getter/setter for mtime
.
If available on the instance, setter will update mtimeMs
.
Type: Number
A millisecond getter/setter for ctime
.
If available on the instance, setter will update ctimeMs
.
Type: Number
A millisecond getter/setter for birthtime
.
If available on the instance, setter will update birthtimeMs
.
Node added millisecond properties starting with v8.1.0. However, these are
instance properties and are disconnected with the Date
equivalent. For
example, updating stat.mtimeMs
will not update stat.mtime
.
As such this module makes atimeMs
, ctimeMs
, mtimeMs
, & birthtimeMs
non-enumerable. Instead use the prototype properties above.
fs.Stats
instances.mode
property.ISC - Copyright © 2018, Cody A. Taylor.
FAQs
fs.Stats constructor with a sane signature and defaults
The npm package stats-ctor receives a total of 37 weekly downloads. As such, stats-ctor popularity was classified as not popular.
We found that stats-ctor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.