@fractools/fileserver

0.4.0 • Public • Published

Fileserver

This is a Module for FractoolsNode

Upload a File

Attention: The fallowing is not finished yet!

Async Method

// Define Fileserver
const fileserver = 'http://localhost:8000/'

// Initialize the form data
const formData = new FormData();

let file = {} // File from Form
let dest = '' // Destination Path

// Add the form data we need to submit
formData.append('file', file);
formData.append('dest', dest);

try {
  let res = await axios.post(`${fileserver}upload`, formData)
  console.log('PDF uploaded', res)
} catch (err) {
  console.log('PDF Upload Error: ', err);
}

File will now be uploaded in /uploads/[...]

Destination

You can define subfolder like the fallowing example:

foo/bar

this will upload the file into /uploads/foo/bar/file.suffix

Package Sidebar

Install

npm i @fractools/fileserver

Weekly Downloads

1

Version

0.4.0

License

MIT

Unpacked Size

24.3 kB

Total Files

15

Last publish

Collaborators

  • consuman
  • equaliser