From 9274504c5dec47b198a40bf43e19239004666d88 Mon Sep 17 00:00:00 2001 From: mickeymond <33749130+mickeymond@users.noreply.github.com> Date: Wed, 27 Mar 2024 23:59:34 +0000 Subject: [PATCH] Using ES Modules --- index.js | 5 +++-- lib/multer-savefilesorg-storage.js | 8 ++++---- package.json | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index c131574..6bdf3cd 100644 --- a/index.js +++ b/index.js @@ -1,2 +1,3 @@ -// Export as named exports -module.exports.MulterSaveFilesOrgStorage = require('./lib/multer-savefilesorg-storage.js') \ No newline at end of file +import multerSavefilesorgStorage from "./lib/multer-savefilesorg-storage.js" + +export const MulterSaveFilesOrgStorage = multerSavefilesorgStorage; \ No newline at end of file diff --git a/lib/multer-savefilesorg-storage.js b/lib/multer-savefilesorg-storage.js index c2842fe..a1f3f94 100644 --- a/lib/multer-savefilesorg-storage.js +++ b/lib/multer-savefilesorg-storage.js @@ -1,6 +1,6 @@ -var axios = require('axios') -var concat = require('concat-stream') -var FormData = require('form-data') +import axios from 'axios' +import concat from 'concat-stream' +import FormData from 'form-data' /* This is a custom multer storage engine that orxy the received data into a savefiles.org drive. @@ -51,6 +51,6 @@ class MulterSaveFilesOrgStorage { } } -module.exports = opts => { +export default opts => { return new MulterSaveFilesOrgStorage(opts) } diff --git a/package.json b/package.json index abeb326..571945d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "multer-savefilesorg-storage", - "version": "1.0.4", + "version": "1.0.5", "description": "Forward multipart/form-data file upload into a savefiles.org drive.", "main": "index.js", + "type": "module", "exports": "./index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"