Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,334 changes: 0 additions & 15,334 deletions dist/index.browser.umd.js

This file was deleted.

33 changes: 8 additions & 25 deletions dist/index.node.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,27 +436,6 @@ class File extends INode {
return;
}

read() {}

write(buffer$$1, position, append) {
let data = this._data;
let bytesWritten;
if (append) {
data = buffer.Buffer.concat([data, buffer$$1]);
bytesWritten = buffer$$1.length;
} else {
position = Math.min(data.length, position);
const overwrittenLength = data.length - position;
const extendedLength = buffer$$1.length - overwrittenLength;
if (extendedLength > 0) {
data = buffer.Buffer.concat([data, buffer.Buffer.allocUnsafe(extendedLength)]);
}
bytesWritten = buffer$$1.copy(data, position);
}
this._data = data;
return bytesWritten;
}

/**
* Noop.
*/
Expand Down Expand Up @@ -567,16 +546,20 @@ class Directory extends INode {
* Rename a name in this directory.
*/
renameEntry(oldName, newName) {
if (oldName === '.' || oldName === '..' || newName === '.' || oldName === '..') {
if (oldName === '.' || oldName === '..' || newName === '.' || newName === '..') {
throw new Error('Not allowed to rename `.` or `..` entries');
}
const index = this._dir.get(oldName);
if (index != null) {
const oldIndex = this._dir.get(oldName);
if (oldIndex != null) {
const now = new Date();
this._metadata.mtime = now;
this._metadata.ctime = now;
const newIndex = this._dir.get(newName);
if (newIndex != null) {
this._iNodeMgr.unlinkINode(this._iNodeMgr.getINode(newIndex));
}
this._dir.delete(oldName);
this._dir.set(newName, index);
this._dir.set(newName, oldIndex);
}
return;
}
Expand Down
33 changes: 8 additions & 25 deletions dist/index.node.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,27 +429,6 @@ class File extends INode {
return;
}

read() {}

write(buffer$$1, position, append) {
let data = this._data;
let bytesWritten;
if (append) {
data = Buffer$1.concat([data, buffer$$1]);
bytesWritten = buffer$$1.length;
} else {
position = Math.min(data.length, position);
const overwrittenLength = data.length - position;
const extendedLength = buffer$$1.length - overwrittenLength;
if (extendedLength > 0) {
data = Buffer$1.concat([data, Buffer$1.allocUnsafe(extendedLength)]);
}
bytesWritten = buffer$$1.copy(data, position);
}
this._data = data;
return bytesWritten;
}

/**
* Noop.
*/
Expand Down Expand Up @@ -560,16 +539,20 @@ class Directory extends INode {
* Rename a name in this directory.
*/
renameEntry(oldName, newName) {
if (oldName === '.' || oldName === '..' || newName === '.' || oldName === '..') {
if (oldName === '.' || oldName === '..' || newName === '.' || newName === '..') {
throw new Error('Not allowed to rename `.` or `..` entries');
}
const index = this._dir.get(oldName);
if (index != null) {
const oldIndex = this._dir.get(oldName);
if (oldIndex != null) {
const now = new Date();
this._metadata.mtime = now;
this._metadata.ctime = now;
const newIndex = this._dir.get(newName);
if (newIndex != null) {
this._iNodeMgr.unlinkINode(this._iNodeMgr.getINode(newIndex));
}
this._dir.delete(oldName);
this._dir.set(newName, index);
this._dir.set(newName, oldIndex);
}
return;
}
Expand Down
96 changes: 48 additions & 48 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset='utf-8' />
<title>virtualfs 2.1.1 | Documentation</title>
<title>virtualfs 2.2.0 | Documentation</title>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
<link href='assets/style.css' type='text/css' rel='stylesheet' />
Expand All @@ -14,7 +14,7 @@
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
<div class='py1 px2'>
<h3 class='mb0 no-anchor'>virtualfs</h3>
<div class='mb1'><code>2.1.1</code></div>
<div class='mb1'><code>2.2.0</code></div>
<input
placeholder='Filter'
id='filter-input'
Expand Down Expand Up @@ -5624,6 +5624,52 @@ <h3 class='fl m0' id='callbackup'>








</section>




<section class='p2 mb2 clearfix bg-white minishadow'>


<div class='clearfix'>

<h3 class='fl m0' id='virtualfserror'>
VirtualFSError
</h3>


</div>




<div class='pre p1 fill-light mt0'>VirtualFSError</div>























Expand Down Expand Up @@ -5715,52 +5761,6 @@ <h3 class='fl m0' id='virtualfserror'>








</section>




<section class='p2 mb2 clearfix bg-white minishadow'>


<div class='clearfix'>

<h3 class='fl m0' id='virtualfserror'>
VirtualFSError
</h3>


</div>




<div class='pre p1 fill-light mt0'>VirtualFSError</div>























Expand Down
35 changes: 8 additions & 27 deletions lib/INodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,6 @@ class File extends INode {
return;
}

read () {

}

write (buffer: Buffer, position: number, append: boolean) {
let data = this._data;
let bytesWritten;
if (append) {
data = Buffer.concat([data, buffer]);
bytesWritten = buffer.length;
} else {
position = Math.min(data.length, position);
const overwrittenLength = data.length - position;
const extendedLength = buffer.length - overwrittenLength;
if (extendedLength > 0) {
data = Buffer.concat([data, Buffer.allocUnsafe(extendedLength)]);
}
bytesWritten = buffer.copy(data, position);
}
this._data = data;
return bytesWritten;
}

/**
* Noop.
*/
Expand Down Expand Up @@ -255,16 +232,20 @@ class Directory extends INode {
* Rename a name in this directory.
*/
renameEntry (oldName: string, newName: string): void {
if (oldName === '.' || oldName === '..' || newName === '.' || oldName === '..') {
if (oldName === '.' || oldName === '..' || newName === '.' || newName === '..') {
throw new Error('Not allowed to rename `.` or `..` entries');
}
const index = this._dir.get(oldName);
if (index != null) {
const oldIndex = this._dir.get(oldName);
if (oldIndex != null) {
const now = new Date;
this._metadata.mtime = now;
this._metadata.ctime = now;
const newIndex = this._dir.get(newName);
if (newIndex != null) {
this._iNodeMgr.unlinkINode(this._iNodeMgr.getINode(newIndex));
}
this._dir.delete(oldName);
this._dir.set(newName, index);
this._dir.set(newName, oldIndex);
}
return;
}
Expand Down
Loading