Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@gigasource/file-explorer-backend
Advanced tools
// The name of the file
fileName: String,
// The folder path of the file (e.g: '/home/', '/documents/work/')
folderPath: String,
// MimeType of the file
mimeType: String,
// If this record is a file or a folder
isFolder: Boolean,
// Size of the file when saved in storage
sizeInBytes: Number,
// File stored on storage system to get the file when needed
// For example:
// if the storage system is S3 or Bunny CDN, it can be an URL: https://bunny/file.txt
// if the storage system is GridFS, it is the ObjectId of the 'files' collection
fileSource: String,
// FileName saved on storage system
generatedFileName: String,
// If namespace middleware is used
namespace: String,
An example of file metadata object:
{
"fileName": "file.txt",
"mimeType": "text/plain",
"folderPath": "/home/docs/",
"sizeInBytes": "123",
"isFolder": true,
"generatedFileName": "random-file-name-65G9-GFDGFD-543534GDV-GT34GFDGDF.txt",
"namespace": "user-admin-1",
"fileSource": "https://bunnycdn/578543785348.txt (or an ObjectId: 8501859174829234 (GridFS))"
}
Pass an mapping object in initFileExplorer function like this:
const {
uploadFile,
downloadFile,
otherApis,
} = initFileExplorer({
dependencies: {
fileMetadataStorage: mongooseFileMetadataStorage,
fileStorage: gridFsFileStorage,
},
propertyMappings: {
fileName: "name",
mimeType: "mime",
folderPath: "folder",
sizeInBytes: "size",
}
});
Then file metadata object will be returned and saved in database with new property names:
{
"name": "file.txt",
"mime": "text/plain",
"folder": "/home/docs/",
"size": "123",
"isFolder": true, (this prop is not mapped so the name will be the default name)
...
}
Check repository https://github.com/gigasource/file-explorer for examples
FAQs
An Express middleware for uploading files
We found that @gigasource/file-explorer-backend demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.