1.0.4 • Published 5 years ago

pml-uploadfile v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

pml-uploadfile

This is a file upload plug-in,Support file stream and string upload。

Note: Windows is partially supported, see #22

Install

$ npm i pml-uploadfile --save

Usage

Introducing plug-ins into projects

const {uploadStreamFile,uploadStringFile} = require('pml-uploadfile');

const result = await uploadStringFile(opts,baseDir);

Return value

{code: 1, urlPath: ""}
{code: 0, error: ""}
  • Description of parameters

uploadStreamFile (opts,baseDir):

let opts = ctx.getFileStream() // file stream
baseDir: app.config.baseDir // default:'';

uploadStringFile (opts,baseDir):

let opts = {
    fileData:fileData, // Picture Base64 byte stream // must
    fileName:fileName, // Save the name of the image // default:time stamp
    fileFormat:fileFormat, //Save the format of the picture // default:jpg
    filePath:filePath // Path to save pictures //default: app/public
}

Questions & Suggestions

More and better inspections will continue to be updated

License

MIT

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago