Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memfs

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memfs - npm Package Compare versions

Comparing version 2.15.1 to 2.15.2

lib/getBigInt.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [2.15.2](https://github.com/streamich/memfs/compare/v2.15.1...v2.15.2) (2019-02-16)
### Bug Fixes
* 🐛 BigInt type handling ([c640f25](https://github.com/streamich/memfs/commit/c640f25))
## [2.15.1](https://github.com/streamich/memfs/compare/v2.15.0...v2.15.1) (2019-02-09)

@@ -2,0 +9,0 @@

2

lib/node.d.ts

@@ -131,3 +131,3 @@ /// <reference types="node" />

seekTo(position: number): void;
stats(): Stats;
stats(): Stats<number>;
write(buf: Buffer, offset?: number, length?: number, position?: number): number;

@@ -134,0 +134,0 @@ read(buf: Buffer | Uint8Array, offset?: number, length?: number, position?: number): number;

import { Node } from './node';
export declare type TStatNumber = number | BigInt;
export declare type TStatNumber = number | bigint;
/**
* Statistics about a file/directory, like `fs.Stats`.
*/
export declare class Stats {
static build(node: Node, bigint?: boolean): Stats;
uid: TStatNumber;
gid: TStatNumber;
rdev: TStatNumber;
blksize: TStatNumber;
ino: TStatNumber;
size: TStatNumber;
blocks: TStatNumber;
export declare class Stats<T = TStatNumber> {
static build(node: Node, bigint: false): Stats<number>;
static build(node: Node, bigint: true): Stats<bigint>;
static build(node: Node, bigint?: boolean): Stats<TStatNumber>;
uid: T;
gid: T;
rdev: T;
blksize: T;
ino: T;
size: T;
blocks: T;
atime: Date;

@@ -19,9 +21,9 @@ mtime: Date;

birthtime: Date;
atimeMs: TStatNumber;
mtimeMs: TStatNumber;
ctimeMs: TStatNumber;
birthtimeMs: TStatNumber;
dev: TStatNumber;
mode: TStatNumber;
nlink: TStatNumber;
atimeMs: T;
mtimeMs: T;
ctimeMs: T;
birthtimeMs: T;
dev: T;
mode: T;
nlink: T;
private _checkModeProperty;

@@ -28,0 +30,0 @@ isDirectory(): boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./constants");
var getBigInt_1 = require("./getBigInt");
var S_IFMT = constants_1.constants.S_IFMT, S_IFDIR = constants_1.constants.S_IFDIR, S_IFREG = constants_1.constants.S_IFREG, S_IFBLK = constants_1.constants.S_IFBLK, S_IFCHR = constants_1.constants.S_IFCHR, S_IFLNK = constants_1.constants.S_IFLNK, S_IFIFO = constants_1.constants.S_IFIFO, S_IFSOCK = constants_1.constants.S_IFSOCK;

@@ -10,20 +11,2 @@ /**

function Stats() {
this.uid = 0;
this.gid = 0;
this.rdev = 0;
this.blksize = 4096;
this.ino = 0;
this.size = 0;
this.blocks = 1;
this.atime = null;
this.mtime = null;
this.ctime = null;
this.birthtime = null;
this.atimeMs = 0.0;
this.mtimeMs = 0.0;
this.ctimeMs = 0.0;
this.birthtimeMs = 0.0;
this.dev = 0;
this.mode = 0;
this.nlink = 0;
}

@@ -34,9 +17,3 @@ Stats.build = function (node, bigint) {

var uid = node.uid, gid = node.gid, atime = node.atime, mtime = node.mtime, ctime = node.ctime;
var getStatNumber = !bigint
? function (number) { return number; }
: typeof BigInt === 'function'
? BigInt
: function () {
throw new Error('BigInt is not supported in this environment.');
};
var getStatNumber = !bigint ? function (number) { return number; } : getBigInt_1.default;
// Copy all values on Stats from Node, so that if Node values

@@ -47,2 +24,7 @@ // change, values on Stats would still be the old ones,

stats.gid = getStatNumber(gid);
stats.rdev = getStatNumber(0);
stats.blksize = getStatNumber(4096);
stats.ino = getStatNumber(node.ino);
stats.size = getStatNumber(node.getSize());
stats.blocks = getStatNumber(1);
stats.atime = atime;

@@ -57,5 +39,4 @@ stats.mtime = mtime;

stats.birthtimeMs = ctimeMs;
stats.size = getStatNumber(node.getSize());
stats.dev = getStatNumber(0);
stats.mode = getStatNumber(node.mode);
stats.ino = getStatNumber(node.ino);
stats.nlink = getStatNumber(node.nlink);

@@ -65,3 +46,3 @@ return stats;

Stats.prototype._checkModeProperty = function (property) {
return (this.mode & S_IFMT) === property;
return (Number(this.mode) & S_IFMT) === property;
};

@@ -68,0 +49,0 @@ Stats.prototype.isDirectory = function () {

@@ -221,11 +221,29 @@ /// <reference types="node" />

private lstatBase;
lstatSync(path: TFilePath, options?: IStatOptions): Stats;
lstatSync(path: TFilePath): Stats<number>;
lstatSync(path: TFilePath, options: {
bigint: false;
}): Stats<number>;
lstatSync(path: TFilePath, options: {
bigint: true;
}): Stats<bigint>;
lstat(path: TFilePath, callback: TCallback<Stats>): any;
lstat(path: TFilePath, options: IStatOptions, callback: TCallback<Stats>): any;
private statBase;
statSync(path: TFilePath, options?: IStatOptions): Stats;
statSync(path: TFilePath): Stats<number>;
statSync(path: TFilePath, options: {
bigint: false;
}): Stats<number>;
statSync(path: TFilePath, options: {
bigint: true;
}): Stats<bigint>;
stat(path: TFilePath, callback: TCallback<Stats>): any;
stat(path: TFilePath, options: IStatOptions, callback: TCallback<Stats>): any;
private fstatBase;
fstatSync(fd: number, options?: IStatOptions): Stats;
fstatSync(fd: number): Stats<number>;
fstatSync(fd: number, options: {
bigint: false;
}): Stats<number>;
fstatSync(fd: number, options: {
bigint: true;
}): Stats<bigint>;
fstat(fd: number, callback: TCallback<Stats>): any;

@@ -232,0 +250,0 @@ fstat(fd: number, options: IStatOptions, callback: TCallback<Stats>): any;

{
"name": "memfs",
"version": "2.15.1",
"version": "2.15.2",
"description": "In-memory file-system with Node's fs API.",

@@ -12,3 +12,3 @@ "main": "lib/index.js",

"clean": "rimraf lib types",
"build": "tsc -p .",
"build": "tsc -p . && cpy src/*.js lib",
"test": "jest",

@@ -34,18 +34,19 @@ "test:coverage": "jest --coverage",

"devDependencies": {
"@semantic-release/changelog": "3.0.2",
"@semantic-release/git": "7.0.8",
"@semantic-release/npm": "5.1.4",
"@types/jest": "23.3.14",
"@types/node": "10.12.24",
"@types/node": "10.12.26",
"cpy-cli": "^2.0.0",
"husky": "1.3.1",
"jest": "21.2.1",
"prettier": "1.16.4",
"pretty-quick": "1.10.0",
"rimraf": "2.6.3",
"semantic-release": "15.13.3",
"@semantic-release/changelog": "3.0.2",
"@semantic-release/npm": "5.1.4",
"@semantic-release/git": "7.0.8",
"ts-jest": "23.10.5",
"ts-node": "7.0.1",
"typescript": "3.3.3",
"prettier": "1.16.4",
"pretty-quick": "1.10.0",
"husky": "1.3.1",
"tslint": "5.12.1",
"tslint-config-common": "1.6.0"
"tslint-config-common": "1.6.0",
"typescript": "3.3.3"
},

@@ -52,0 +53,0 @@ "config": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc