TheDesk Riina (ver.3)
This commit is contained in:
43
app/node_modules/read-chunk/index.js
generated
vendored
Normal file
43
app/node_modules/read-chunk/index.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = function (filepath, pos, len, cb) {
|
||||
var buf = new Buffer(len);
|
||||
|
||||
fs.open(filepath, 'r', function (err, fd) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
fs.read(fd, buf, 0, len, pos, function (err, bytesRead, buf) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
fs.close(fd, function (err) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
if (bytesRead < len) {
|
||||
buf = buf.slice(0, bytesRead);
|
||||
}
|
||||
|
||||
cb(null, buf);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = function (filepath, pos, len) {
|
||||
var buf = new Buffer(len);
|
||||
var fd = fs.openSync(filepath, 'r');
|
||||
var bytesRead = fs.readSync(fd, buf, 0, len, pos);
|
||||
fs.closeSync(fd);
|
||||
|
||||
if (bytesRead < len) {
|
||||
buf = buf.slice(0, bytesRead);
|
||||
}
|
||||
|
||||
return buf;
|
||||
};
|
101
app/node_modules/read-chunk/package.json
generated
vendored
Normal file
101
app/node_modules/read-chunk/package.json
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "read-chunk@^1.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "read-chunk",
|
||||
"name": "read-chunk",
|
||||
"rawSpec": "^1.0.1",
|
||||
"spec": ">=1.0.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\jimp"
|
||||
]
|
||||
],
|
||||
"_from": "read-chunk@>=1.0.1 <2.0.0",
|
||||
"_id": "read-chunk@1.0.1",
|
||||
"_inCache": true,
|
||||
"_location": "/read-chunk",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "read-chunk@^1.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "read-chunk",
|
||||
"name": "read-chunk",
|
||||
"rawSpec": "^1.0.1",
|
||||
"spec": ">=1.0.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jimp"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/read-chunk/-/read-chunk-1.0.1.tgz",
|
||||
"_shasum": "5f68cab307e663f19993527d9b589cace4661194",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "read-chunk@^1.0.1",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\jimp",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/read-chunk/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Read a chunk from a file",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "5f68cab307e663f19993527d9b589cace4661194",
|
||||
"tarball": "https://registry.npmjs.org/read-chunk/-/read-chunk-1.0.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "6abec373c92cee4e07a721ca5a0cd8a187bb04ad",
|
||||
"homepage": "https://github.com/sindresorhus/read-chunk",
|
||||
"keywords": [
|
||||
"read",
|
||||
"file",
|
||||
"readfile",
|
||||
"fs",
|
||||
"chunk",
|
||||
"slice",
|
||||
"part",
|
||||
"head",
|
||||
"tail",
|
||||
"buffer",
|
||||
"fd",
|
||||
"open"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "read-chunk",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/read-chunk.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
61
app/node_modules/read-chunk/readme.md
generated
vendored
Normal file
61
app/node_modules/read-chunk/readme.md
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# read-chunk [](https://travis-ci.org/sindresorhus/read-chunk)
|
||||
|
||||
> Read a chunk from a file
|
||||
|
||||
Because the built-in way is too much boilerplate.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save read-chunk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var readChunk = require('read-chunk');
|
||||
|
||||
// foo.txt => hello
|
||||
|
||||
readChunk.sync('foo.txt', 1, 3);
|
||||
//=> ell
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### readChunk(filepath, position, length, callback)
|
||||
|
||||
#### filepath
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### position
|
||||
|
||||
Type: `number`
|
||||
|
||||
Position to start reading.
|
||||
|
||||
#### length
|
||||
|
||||
Type: `number`
|
||||
|
||||
Number of bytes to read.
|
||||
|
||||
#### callback(error, buffer)
|
||||
|
||||
Type: `function`
|
||||
|
||||
|
||||
### readChunk.sync(filepath, start, length)
|
||||
|
||||
Same arguments as `readChunk` except the callback.
|
||||
|
||||
Returns a buffer.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
Reference in New Issue
Block a user