npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@getlarge/nestjs-tools-file-storage

v1.4.2

Published

File Storage Juggler

Readme

File-storage

npm

This module provide a unified API to store files in different storage providers.

Supoorted backends:

Installation

npm install --save @getlarge/nestjs-tools-file-storage

Example

// module.ts
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { FileStorageLocal, FileStorageModule, FileStorageS3 } from '@getlarge/nestjs-tools-file-storage';

import { AppService } from './env';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
    }),
    FileStorageModule.forRootAsync({
      inject: [ConfigService],
      useFactory: (configService: ConfigService) => {
        const environment = configService.get('NODE_ENV', { infer: true });
        if (environment === 'development') {
          const setup = {
            storagePath: configService.get('STORAGE_PATH'),
            maxPayloadSize: configService.get('MAX_PAYLOAD_SIZE'),
          };
          return new FileStorageLocal(setup);
        }
        const setup = {
          maxPayloadSize: configService.get('MAX_PAYLOAD_SIZE'),
          bucket: configService.get('AWS_S3_BUCKET'),
          region: configService.get('AWS_S3_REGION'),
          credentials: {
            accessKeyId: configService.get('AWS_S3_ACCESS_KEY_ID'),
            secretAccessKey: configService.get('AWS_S3_SECRET_ACCESS_KEY'),
          },
        };
        return new FileStorageS3(setup);
      },
    }),
  ],
  providers: [AppService],
})
export class AppModule {}
// service.ts
import { FileStorageService } from '@getlarge/nestjs-tools-file-storage';
import { Inject, Injectable, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class AppService {
  constructor(
    @Inject(ConfigService) private readonly configService: ConfigService,
    @Inject(FileStorageService)
    private readonly fileStorageService: FileStorageService,
  ) {}

  getFile(filePath: string): Promise<Buffer> {
    return this.fileStorage.downloadFile({ filePath });
  }

  setFile(filePath: string, content: string): Promise<void> {
    return this.fileStorage.uploadFile({
      filePath,
      content,
    });
  }

  deleteFile(filePath: string): Promise<void> {
    return this.fileStorage.deleteFile({ filePath });
  }
}

Testing

To run the tests, you need to have a .env.test file in the root of the project following the structure of the .env.test.sample file. You should also authenticate to external services.

AWS

I highly recommend configuring the AWS Identity Center to manage your AWS credentials for development.

Note: You can use the aws CLI to authenticate, find more information here.

Once authenticated:

  • set the AWS_PROFILE environment variable to the profile you want to use
  • or set the AWS_S3_ACCESS_KEY_ID and AWS_S3_SECRET_ACCESS_KEY environment variables.

Google Cloud

The recommended approach is to setup Application Default Credentials.

Note: You can use the gcloud CLI to authenticate, more information here.

Troubleshooting

If, after upgrading, you get the following error:

/usr/local/bin/node[57897]: ../src/node_http_parser.cc:517:static void node::(anonymous namespace)::Parser::Execute(const FunctionCallbackInfo<v8::Value> &): Assertion `parser->current_buffer_.IsEmpty()' failed.

You need to update to node v18.6 or higher. This is due to an issue with the node http module. More information can be found here and here.