all da files
This commit is contained in:
1
node_modules/filesystem-browserify/node_modules/fileliststream/.npmignore
generated
vendored
Normal file
1
node_modules/filesystem-browserify/node_modules/fileliststream/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
60
node_modules/filesystem-browserify/node_modules/fileliststream/README.md
generated
vendored
Normal file
60
node_modules/filesystem-browserify/node_modules/fileliststream/README.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# fileliststream
|
||||
|
||||
Given a FileList, turn it into a FileListStream.
|
||||
|
||||
# install
|
||||
|
||||
Use it with npm & [browserify](/substack/node-browserify)
|
||||
|
||||
```bash
|
||||
$ npm install fileliststream
|
||||
```
|
||||
|
||||
# example
|
||||
```js
|
||||
const FileListStream = require('fileliststream');
|
||||
const body = document.body;
|
||||
|
||||
// make it so console can be piped to.
|
||||
console.write = console.log;
|
||||
|
||||
function noop(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
};
|
||||
|
||||
['dragenter',
|
||||
'dragleave',
|
||||
'dragexit',
|
||||
'dragover'
|
||||
].forEach(function (eventType) {
|
||||
body.addEventListener(eventType, noop);
|
||||
});
|
||||
|
||||
body.addEventListener('drop', function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
const fileList = FileListStream(event.dataTransfer.files);
|
||||
|
||||
fileList.files.map(function(file) {
|
||||
file.pipe(console);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
```
|
||||
|
||||
# usage
|
||||
|
||||
```js
|
||||
FileListStream(fileList, [options])
|
||||
```
|
||||
|
||||
`options` currently has one possible parameter, `output`. Possible values are:
|
||||
|
||||
* `binary` [default]
|
||||
* `dataurl`
|
||||
* `arraybuffer`
|
||||
* `text`
|
220
node_modules/filesystem-browserify/node_modules/fileliststream/bundle.js
generated
vendored
Normal file
220
node_modules/filesystem-browserify/node_modules/fileliststream/bundle.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
node_modules/filesystem-browserify/node_modules/fileliststream/example.html
generated
vendored
Normal file
5
node_modules/filesystem-browserify/node_modules/fileliststream/example.html
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body style="width: 100%; height: 100%; padding: 0; background: #aaf">
|
||||
<script src='bundle.js'></script>
|
||||
</body>
|
||||
</html>
|
34
node_modules/filesystem-browserify/node_modules/fileliststream/example.js
generated
vendored
Normal file
34
node_modules/filesystem-browserify/node_modules/fileliststream/example.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
const FileListStream = require('./');
|
||||
const body = document.body;
|
||||
|
||||
// make it so console can be piped to.
|
||||
console.write = console.log;
|
||||
|
||||
function noop(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
};
|
||||
|
||||
['dragenter',
|
||||
'dragleave',
|
||||
'dragexit',
|
||||
'dragover'
|
||||
].forEach(function (eventType) {
|
||||
body.addEventListener(eventType, noop);
|
||||
});
|
||||
|
||||
body.addEventListener('drop', function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
const fileList = FileListStream(event.dataTransfer.files, {
|
||||
output: 'text'
|
||||
});
|
||||
|
||||
fileList.files.map(function(file) {
|
||||
file.pipe(console);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
54
node_modules/filesystem-browserify/node_modules/fileliststream/index.js
generated
vendored
Normal file
54
node_modules/filesystem-browserify/node_modules/fileliststream/index.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
const Stream = require('stream');
|
||||
|
||||
function FileListStream(fileList, options) {
|
||||
if (!(this instanceof FileListStream))
|
||||
return new FileListStream(fileList, options);
|
||||
this.files = [].slice.call(fileList).map(function (file) {
|
||||
return new FileStream(file, options);
|
||||
});
|
||||
this.files.forEach(function (file, idx) {
|
||||
this[idx] = file;
|
||||
}, this);
|
||||
};
|
||||
|
||||
function FileStream(file, options) {
|
||||
if (!(this instanceof FileStream))
|
||||
return new FileStream(file, options);
|
||||
options = options || {};
|
||||
options.output = options.output || 'binary';
|
||||
this.options = options;
|
||||
this._file = file;
|
||||
this.readable = true;
|
||||
['name',
|
||||
'size',
|
||||
'type',
|
||||
'lastModifiedDate'].forEach(function (thing) {
|
||||
this[thing] = file[thing];
|
||||
}, this);
|
||||
};
|
||||
|
||||
FileStream.prototype.pipe = function pipe(dest, options) {
|
||||
const outputType = this.options.output;
|
||||
const reader = new FileReader();
|
||||
reader.onload = function loaded(event) {
|
||||
dest.write(event.target.result);
|
||||
if (dest !== console && (!options || options.end !== false)) {
|
||||
if (dest.end)
|
||||
dest.end();
|
||||
if (dest.close)
|
||||
dest.close();
|
||||
}
|
||||
};
|
||||
|
||||
if (outputType === 'binary')
|
||||
reader.readAsBinaryString(this._file);
|
||||
else if (outputType === 'dataurl')
|
||||
reader.readAsDataURL(this._file);
|
||||
else if (outputType === 'arraybuffer')
|
||||
reader.readAsArrayBuffer(this._file);
|
||||
else if (outputType === 'text')
|
||||
reader.readAsText(this._file);
|
||||
return dest;
|
||||
};
|
||||
|
||||
module.exports = FileListStream;
|
35
node_modules/filesystem-browserify/node_modules/fileliststream/package.json
generated
vendored
Normal file
35
node_modules/filesystem-browserify/node_modules/fileliststream/package.json
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "fileliststream",
|
||||
"version": "0.0.2",
|
||||
"description": "Convert a DOM FileList to a FileListStream",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"browserify": "~1.17.2"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/brianloveswords/fileliststream.git"
|
||||
},
|
||||
"keywords": [
|
||||
"filelist",
|
||||
"fileliststream",
|
||||
"dom",
|
||||
"filereader"
|
||||
],
|
||||
"author": {
|
||||
"name": "Brian J. Brennan"
|
||||
},
|
||||
"license": "MIT",
|
||||
"readmeFilename": "README.md",
|
||||
"gitHead": "b81694fd3cc54de6f5efd9a738977b99db431495",
|
||||
"readme": "# fileliststream\n\nGiven a FileList, turn it into a FileListStream.\n\n# install\n\nUse it with npm & [browserify](/substack/node-browserify)\n\n```bash\n$ npm install fileliststream\n```\n\n# example\n```js\nconst FileListStream = require('fileliststream');\nconst body = document.body;\n\n// make it so console can be piped to.\nconsole.write = console.log;\n\nfunction noop(event) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n};\n\n['dragenter',\n 'dragleave',\n 'dragexit',\n 'dragover'\n].forEach(function (eventType) {\n body.addEventListener(eventType, noop);\n});\n\nbody.addEventListener('drop', function (event) {\n event.stopPropagation();\n event.preventDefault();\n\n const fileList = FileListStream(event.dataTransfer.files);\n\n fileList.files.map(function(file) {\n file.pipe(console);\n });\n\n return false;\n});\n```\n\n# usage\n\n```js\nFileListStream(fileList, [options])\n```\n\n`options` currently has one possible parameter, `output`. Possible values are:\n\n* `binary` [default]\n* `dataurl`\n* `arraybuffer`\n* `text`\n",
|
||||
"_id": "fileliststream@0.0.2",
|
||||
"dist": {
|
||||
"shasum": "3b12f9d8ad4df169fd40c6d674827d416a68aab1"
|
||||
},
|
||||
"_from": "fileliststream@~0.0.1"
|
||||
}
|
Reference in New Issue
Block a user