npm install pml-uploadfileThis is a file upload plug-in,Support file stream and string upload。
Note: Windows is partially supported, see #22
``bash`
$ npm i pml-uploadfile --save
Introducing plug-ins into projects
`js
const {uploadStreamFile,uploadStringFile} = require('pml-uploadfile');
const result = await uploadStringFile(opts,baseDir);
`
json
{code: 1, urlPath: ""}
{code: 0, error: ""}
`
- Description of parametersuploadStreamFile (opts,baseDir):
`js
let opts = ctx.getFileStream() // file stream
baseDir: app.config.baseDir // default:'';
`uploadStringFile (opts,baseDir):
`js
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
}
``More and better inspections will continue to be updated