在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):morris/vinyl-ftp开源软件地址(OpenSource Url):https://github.com/morris/vinyl-ftp开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):vinyl-ftpBlazing fast vinyl adapter for FTP. Supports parallel transfers, conditional transfers, buffered or streamed files, and more. Often performs better than your favorite desktop FTP client. UsageNice and gulpy deployment task: var gulp = require( 'gulp' );
var gutil = require( 'gulp-util' );
var ftp = require( 'vinyl-ftp' );
gulp.task( 'deploy', function () {
var conn = ftp.create( {
host: 'mywebsite.tld',
user: 'me',
password: 'mypass',
parallel: 10,
log: gutil.log
} );
var globs = [
'src/**',
'css/**',
'js/**',
'fonts/**',
'index.html'
];
// using base = '.' will transfer everything to /public_html correctly
// turn off buffering in gulp.src for best performance
return gulp.src( globs, { base: '.', buffer: false } )
.pipe( conn.newer( '/public_html' ) ) // only upload newer files
.pipe( conn.dest( '/public_html' ) );
} ); Without Gulp: var fs = require( 'vinyl-fs' );
var ftp = require( 'vinyl-ftp' );
var conn = new ftp( /* ... */ );
fs.src( [ './src/**' ], { buffer: false } )
.pipe( conn.dest( '/dst' ) ); Remember not to push FTP credentials to public repos! API
ftp.create( config )Return a new
You can override
conn.src( globs[, options] ) STREAMReturns a vinyl file stream that emits remote files matched by the given
globs.
The remote files have a
Glob-related options are documented at minimatch. conn.dest( remoteFolder[, options] ) STREAMReturns a transform stream that transfers input files to a remote folder. All directories are created automatically. Passes input files through. conn.mode( remoteFolder, mode[, options] ) STREAMReturns a transform stream that sets remote file permissions for each file.
conn.newer( remoteFolder[, options] ) STREAMReturns a transform stream which filters the input for files which are newer than their remote counterpart. conn.differentSize( remoteFolder[, options] ) STREAMReturns a transform stream which filters the input for files which have a different file size than their remote counterpart. conn.newerOrDifferentSize( remoteFolder[, options] ) STREAMSee above. conn.filter( remoteFolder, filter[, options] ) STREAMReturns a transform stream that filters the input using a callback. The callback should be of this form: function ( localFile, remoteFile, callback ) {
// localFile and remoteFile are vinyl files.
// Check remoteFile.ftp for remote information.
// Decide wether localFile should be emitted and call callback with boolean.
// callback is a function( error, emit )
callback( null, emit );
} conn.delete( path, cb ) CALLBACKDeletes a file. conn.rmdir( path, cb ) CALLBACKRemoves a directory, recursively. conn.clean( globs, local[, options] ) STREAMGlobs remote files, tests if they are locally available at Development
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论