Giter VIP home page Giter VIP logo

file-storage's People

Contributors

dangnfq avatar dangnguyenemma avatar dangoceaneering avatar dependabot[bot] avatar googlicius avatar lukadriel7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

file-storage's Issues

Importing the default doesn't work when using ES2022 modules

I'm working on an application that uses ES2022 modules. So I've set "type": "module" in package.json and the TypeScript settings are "target": "ES2022", "module": "ES2022".

I'm experiencing the following issue:

When I import the Storage class like this and run it I get an error:

import Storage from '@file-storage/core';
Storage.config({});

Error:

Storage.config({});
        ^
TypeError: Storage.config is not a function

There are currently two workaround I have found:

  • I can turn off typechecking and call (Storage as any).default.config({});
  • I can import the Storage class like this: import { Storage } from '@file-storage/core/dist/file-storage.js';

It's also possible to get a proper import by downgrading the whole application to CommonJS module (remove "type": "module" from package.json and set "module": "CommonJS" in tsconfig.json), but I can't do that as other packages only work in a ESNext module.

I've created a minimal sample to reproduce the issue: https://github.com/sr258/file-storage-minimal-sample

Steps to reproduce:

  • Clone the repo
  • npm install
  • npm build
  • npm run start:error

It looks like way the class is exported doesn't work with a fully ES2022 module.

uniqueFileName not respected when calling Storage.disk(...)

uniqueFileName not respected when calling Storage.disk(...)

When setting the uniqueFileName global to true:

    Storage.config<BuiltInDiskConfig>({
      uniqueFileName: true,
      defaultDiskName: 'local',
      diskConfigs: [
        {
          driver: DriverName.LOCAL,
          name: 'local',
          root: 'media'
        }
      ]
    });

The internal default disk works fine, we get the unique file with extension .txt:

    await Storage.put(Buffer.from("I am a unique one."), "asd.txt");

However, when calling the disk getter, the setting is not applied:

   await Storage.disk('local').put(Buffer.from("I will overwrite asd.txt"), "asd.txt");

Could be an easy fix!

Install of @file-storage/commin fails on Docker & Mac silicon because of sharp

Install of @file-storage/commin fails on Docker & Mac silicon because of sharp

When I add the dependency @file-storage/common using yarn it fails with this message:

error /app/node_modules/@file-storage/common/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments: 
Directory: /app/node_modules/@file-storage/common/node_modules/sharp
Output:
sharp: Installation error: Invalid Version: 1.2.4_git20230717

According to this issue this sharp problem has been fixed at version 0.29, but the common package still references 0.28.

Would it be possible to upgrade to at least 0.29 ? I can open a pull request if you want.

Beside, why is sharpeven required ? Image stats fetching could be done within an extra package like @file-storage/image. Also, maybe extracting metadata using node-imagemagick could be a solid alternative as it relies on top of imagemagick command that is pretty standard on debian-based distros. Anyway, these are just suggestions :)

However, and because this issue blocks my current development, I'm afraid I'll give a try to storage-abstraction instead :/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.