Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smart-uploader

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smart-uploader

A simple ftp uploader with queue management

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ftp-uploader

A simple ftp uploader with queue management.

Example

import {
  Uploader,
  ICredential,
  Behavior,
  FileItem,
  IFileItem,
  IProgress,
} from '../src';

const cre: ICredential = {
  host: '127.0.0.1',
  port: 21,
  user: 'uploader',
  password: 'Passw0rd',
};

const uploader = new Uploader({ credentials: cre, behavior: Behavior.Cover });

uploader.onBeforeUploadItem = function before(item: FileItem | null) {
  if (item) {
    console.log('开始上传:', item.localPath);
  }
};

uploader.onAfterUploadItem = function after(item: FileItem | null) {
  if (item) {
    console.log('上传完毕:', item.localPath);
  }
};

uploader.onErrorUploadItem = function error(item: FileItem | null) {
  if (item) {
    console.log(`上传出错: ${item.localPath} ${item.error}`);
  }
};

uploader.onConnectionError = function connectionError(error) {
  console.log(`连接出错: ${error.message}`);
};


uploader.onProgress = function progress(pro: IProgress) {
  console.log(`progress: `, pro);
};

const file: IFileItem = {
  name: 'demo.exe',
  localPath: 'E:\\demo\\demo.exe',
  serverPath: '/demo.exe',
  size: 4013920256,
  isDirectory: false,
};

uploader.upload([file]);

FAQs

Package last updated on 26 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc