WIP - add extractor, generate snippet_data
This commit is contained in:
11
node_modules/md5-file/LICENSE.md
generated
vendored
Normal file
11
node_modules/md5-file/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 - 2017 Rory Bradford and contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
61
node_modules/md5-file/README.md
generated
vendored
Normal file
61
node_modules/md5-file/README.md
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
# md5-file [](https://travis-ci.org/roryrjb/md5-file) [](https://github.com/feross/standard)
|
||||
|
||||
Get the MD5-sum of a given file, with low memory usage, even on huge files.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save md5-file
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### As a module
|
||||
```js
|
||||
const md5File = require('md5-file')
|
||||
|
||||
/* Async usage */
|
||||
md5File('LICENSE.md', (err, hash) => {
|
||||
if (err) throw err
|
||||
|
||||
console.log(`The MD5 sum of LICENSE.md is: ${hash}`)
|
||||
})
|
||||
|
||||
/* Sync usage */
|
||||
const hash = md5File.sync('LICENSE.md')
|
||||
console.log(`The MD5 sum of LICENSE.md is: ${hash}`)
|
||||
```
|
||||
|
||||
### As a command line tool
|
||||
```
|
||||
$ md5-file LICENSE.md
|
||||
```
|
||||
|
||||
## Promise support
|
||||
|
||||
If you require `md5-file/promise` you'll receive an alternative API where all
|
||||
functions that takes callbacks are replaced by `Promise`-returning functions.
|
||||
|
||||
```js
|
||||
const md5File = require('md5-file/promise')
|
||||
|
||||
md5File('LICENSE.md').then(hash => {
|
||||
console.log(`The MD5 sum of LICENSE.md is: ${hash}`)
|
||||
})
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `md5File(filepath: string, cb: function)`
|
||||
|
||||
Asynchronously get the MD5-sum of the file at `filepath`.
|
||||
|
||||
The callback `cb` will be called with `(err: Error, hash: string)`.
|
||||
|
||||
### `md5File.sync(filepath: string) => string`
|
||||
|
||||
Synchronously get the MD5-sum of the file at `filepath`.
|
||||
|
||||
### License
|
||||
|
||||
MIT
|
||||
7
node_modules/md5-file/cli.js
generated
vendored
Executable file
7
node_modules/md5-file/cli.js
generated
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
const md5File = require('./')
|
||||
|
||||
console.log(md5File.sync(process.argv[2]))
|
||||
46
node_modules/md5-file/index.js
generated
vendored
Normal file
46
node_modules/md5-file/index.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict'
|
||||
|
||||
var crypto = require('crypto')
|
||||
var fs = require('fs')
|
||||
var alloc = require('buffer-alloc')
|
||||
|
||||
var BUFFER_SIZE = 8192
|
||||
|
||||
function md5FileSync (filename) {
|
||||
var fd = fs.openSync(filename, 'r')
|
||||
var hash = crypto.createHash('md5')
|
||||
var buffer = alloc(BUFFER_SIZE)
|
||||
|
||||
try {
|
||||
var bytesRead
|
||||
|
||||
do {
|
||||
bytesRead = fs.readSync(fd, buffer, 0, BUFFER_SIZE)
|
||||
hash.update(buffer.slice(0, bytesRead))
|
||||
} while (bytesRead === BUFFER_SIZE)
|
||||
} finally {
|
||||
fs.closeSync(fd)
|
||||
}
|
||||
|
||||
return hash.digest('hex')
|
||||
}
|
||||
|
||||
function md5File (filename, cb) {
|
||||
if (typeof cb !== 'function') throw new TypeError('Argument cb must be a function')
|
||||
|
||||
var output = crypto.createHash('md5')
|
||||
var input = fs.createReadStream(filename)
|
||||
|
||||
input.on('error', function (err) {
|
||||
cb(err)
|
||||
})
|
||||
|
||||
output.once('readable', function () {
|
||||
cb(null, output.read().toString('hex'))
|
||||
})
|
||||
|
||||
input.pipe(output)
|
||||
}
|
||||
|
||||
module.exports = md5File
|
||||
module.exports.sync = md5FileSync
|
||||
71
node_modules/md5-file/package.json
generated
vendored
Normal file
71
node_modules/md5-file/package.json
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "md5-file@^3.1.1",
|
||||
"_id": "md5-file@3.2.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-3Tkp1piAHaworfcCgH0jKbTvj1jWWFgbvh2cXaNCgHwyTCBxxvD1Y04rmfpvdPm1P4oXMOpm6+2H7sr7v9v8Fw==",
|
||||
"_location": "/md5-file",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "md5-file@^3.1.1",
|
||||
"name": "md5-file",
|
||||
"escapedName": "md5-file",
|
||||
"rawSpec": "^3.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby",
|
||||
"/gatsby-source-filesystem"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/md5-file/-/md5-file-3.2.3.tgz",
|
||||
"_shasum": "f9bceb941eca2214a4c0727f5e700314e770f06f",
|
||||
"_spec": "md5-file@^3.1.1",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby",
|
||||
"author": {
|
||||
"name": "Rory Bradford",
|
||||
"email": "rory@dysfunctionalprogramming.com"
|
||||
},
|
||||
"bin": {
|
||||
"md5-file": "cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/roryrjb/md5-file/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"buffer-alloc": "^1.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "return an md5sum of a given file",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.4.5",
|
||||
"standard": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
},
|
||||
"files": [
|
||||
"cli.js",
|
||||
"index.js",
|
||||
"promise.js"
|
||||
],
|
||||
"homepage": "https://github.com/roryrjb/md5-file#readme",
|
||||
"keywords": [
|
||||
"md5",
|
||||
"md5sum",
|
||||
"checksum"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "md5-file",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/roryrjb/md5-file.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && mocha"
|
||||
},
|
||||
"version": "3.2.3"
|
||||
}
|
||||
16
node_modules/md5-file/promise.js
generated
vendored
Normal file
16
node_modules/md5-file/promise.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
var md5File = require('./')
|
||||
|
||||
function md5FileAsPromised (filename) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
md5File(filename, function (err, hash) {
|
||||
if (err) return reject(err)
|
||||
|
||||
resolve(hash)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = md5FileAsPromised
|
||||
module.exports.sync = md5File.sync
|
||||
Reference in New Issue
Block a user