first commit

This commit is contained in:
armansansd
2023-07-12 16:31:19 +01:00
commit 3424b1927b
23306 changed files with 2217776 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
## The MIT License (MIT) ##
Copyright (c) 2014 Hugh Kennedy
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.
+42
View File
@@ -0,0 +1,42 @@
# vinyl-buffer [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/vinyl-buffer&title=vinyl-buffer&description=hughsk/vinyl-buffer%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #
Convert streaming [vinyl](http://github.com/wearefractal/vinyl) files to use
buffers.
An alternative to [gulp-streamify](http://github.com/nfroidure/gulp-streamify)
that you can pipe to, instead of being required to wrap your streams.
``` javascript
var browserify = require('browserify')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var uglify = require('gulp-uglify')
var size = require('gulp-size')
var gulp = require('gulp')
gulp.task('build', function() {
var bundler = browserify('./index.js')
return bundler.bundle()
.pipe(source('index.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(size())
.pipe(gulp.dest('dist/'))
})
```
## Usage ##
[![vinyl-buffer](https://nodei.co/npm/vinyl-buffer.png?mini=true)](https://nodei.co/npm/vinyl-buffer)
### `vinylBuffer()` ###
Creates a transform stream that takes vinyl files as input, and outputs
modified vinyl files as output. If `file.isStream()`, `file.contents` will
be converted to a `Buffer` before being emitted again otherwise, the file
will be emitted immediately.
## License ##
MIT. See [LICENSE.md](http://github.com/hughsk/vinyl-buffer/blob/master/LICENSE.md) for details.
+28
View File
@@ -0,0 +1,28 @@
var through2 = require('through2').obj
var bl = require('bl')
module.exports = vinylBuffer
function vinylBuffer() {
var stream = through2(write)
return stream
function write(file, _, next) {
if (file.isNull()) return push(file, next)
if (file.isBuffer()) return push(file, next)
file.contents.pipe(bl(function(err, data) {
if (err) return next(err)
file.contents = data
push(file, next)
}))
}
function push(file, next) {
stream.push(file)
next()
}
}
+64
View File
@@ -0,0 +1,64 @@
{
"_from": "vinyl-buffer",
"_id": "vinyl-buffer@1.0.1",
"_inBundle": false,
"_integrity": "sha1-lsGjR5uMU5JULGEgKQE7Wyf4i78=",
"_location": "/vinyl-buffer",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "vinyl-buffer",
"name": "vinyl-buffer",
"escapedName": "vinyl-buffer",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#DEV:/",
"#USER"
],
"_resolved": "https://registry.npmjs.org/vinyl-buffer/-/vinyl-buffer-1.0.1.tgz",
"_shasum": "96c1a3479b8c5392542c612029013b5b27f88bbf",
"_spec": "vinyl-buffer",
"_where": "/srv/http/mmap_sarrebourg/user/themes/basic",
"author": {
"name": "Hugh Kennedy",
"email": "hughskennedy@gmail.com",
"url": "http://hughsk.io/"
},
"bugs": {
"url": "https://github.com/hughsk/vinyl-buffer/issues"
},
"bundleDependencies": false,
"dependencies": {
"bl": "^1.2.1",
"through2": "^2.0.3"
},
"deprecated": false,
"description": "Convert streaming vinyl files to use buffers",
"devDependencies": {
"tape": "~2.5.0",
"vinyl-source-stream": "~2.0.0"
},
"homepage": "https://github.com/hughsk/vinyl-buffer",
"keywords": [
"vinyl",
"gulpfriendly",
"convert",
"buffer",
"stream"
],
"license": "MIT",
"main": "index.js",
"name": "vinyl-buffer",
"repository": {
"type": "git",
"url": "git://github.com/hughsk/vinyl-buffer.git"
},
"scripts": {
"test": "node test"
},
"version": "1.0.1"
}
+26
View File
@@ -0,0 +1,26 @@
var source = require('vinyl-source-stream')
var buffer = require('./')
var test = require('tape')
var fs = require('fs')
test('converted', function(t) {
t.plan(2)
fs.createReadStream(__filename)
.pipe(source('bundle.js'))
.pipe(buffer())
.once('data', function(file) {
t.ok(!file.isStream(), 'is not a stream')
t.ok( file.isBuffer(), 'is a buffer')
})
})
test('not converted', function(t) {
t.plan(2)
fs.createReadStream(__filename)
.pipe(source('bundle.js'))
.once('data', function(file) {
t.ok( file.isStream(), 'is a stream')
t.ok(!file.isBuffer(), 'is not a buffer')
})
})