0.7.29 • Published 12 days ago

@anchan828/nest-storage v0.7.29

Weekly downloads
604
License
MIT
Repository
github
Last release
12 days ago

@anchan828/nest-storage

Install

npm i @anchan828/nest-storage @anchan828/nest-storage-express

Usage

You need to import 2 modules

  • StorageModule
    • This is core module
  • ProviderModule
    • The storage provider you want to use
@Module({
  imports: [
    StorageModule.register({
      bucket: "bucket",
      cacheDir: "path/to/cacheDir",
    }),
    LocalStorageProviderModule.register(),
  ],
})
export class AppModule {}
export class Service {
  constructor(private readonly service: StorageService) {}

  public async uploadFile(): Promise<void> {
    const dataPath = "local-path.txt";
    await this.service.upload(dataPath, "path/to/test.txt");
  }
}

Storage providers

You can set some storage providers.

ProviderPakcage
Local (express)@anchan828/nest-storage-express
Google Cloud Storage@anchan828/nest-storage-gcs
Amazon S3@anchan828/nest-storage-s3

Signed URL

You can get signed URL

await this.service.getSignedUrl(filename, {
  action: "upload" | "download" | "delete",
  // Milliseconds. default is 900000 = 15 mins
  expires: number,
});
// => /_signed_url/bucket/test.txt?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3Rpb24iOiJ1cGxvYWQiLCJleHBpcmVzIjo5MDAwMDAsImJ1Y2tldCI6ImJ1Y2tldCIsImZpbGVuYW1lIjoidGVzdC50eHQiLCJpYXQiOjE1NzkzMjM2MTYsImV4cCI6MTU4MDIyMzYxNn0.iJfq01VBExCvlGhKcT8hQ9d2lGTLW4miiACX3sG5HO8

responseDispositionFilename

You can use the option to customize the file name when downloading file. If you use this, content-disposition: attachment; filename=\"${filename}\" will be added to the header when downloading.

await this.service.getSignedUrl(filename, {
  action: "download",
  responseDispositionFilename: "changed-filename.txt",
});
0.7.29

12 days ago

0.7.26

1 month ago

0.7.28

19 days ago

0.7.27

26 days ago

0.7.22

2 months ago

0.7.21

2 months ago

0.7.24

2 months ago

0.7.23

2 months ago

0.7.20

2 months ago

0.7.25

1 month ago

0.7.19

3 months ago

0.7.18

3 months ago

0.7.17

3 months ago

0.7.11

4 months ago

0.7.10

5 months ago

0.7.13

4 months ago

0.7.12

4 months ago

0.7.15

3 months ago

0.7.14

4 months ago

0.7.16

3 months ago

0.7.9

5 months ago

0.7.6

6 months ago

0.7.5

6 months ago

0.7.8

5 months ago

0.7.7

5 months ago

0.7.2

6 months ago

0.7.1

7 months ago

0.7.4

6 months ago

0.7.3

6 months ago

0.7.0

7 months ago

0.6.17

7 months ago

0.6.16

7 months ago

0.6.14

8 months ago

0.6.15

7 months ago

0.6.13

8 months ago

0.6.12

8 months ago

0.6.11

8 months ago

0.6.10

9 months ago

0.6.9

9 months ago

0.6.8

9 months ago

0.6.7

9 months ago

0.6.6

10 months ago

0.6.5

10 months ago

0.6.4

10 months ago

0.6.3

10 months ago

0.5.18

10 months ago

0.5.19

10 months ago

0.6.2

10 months ago

0.6.1

10 months ago

0.5.17

11 months ago

0.6.0

11 months ago

0.5.16

11 months ago

0.5.15

11 months ago

0.5.14

11 months ago

0.5.13

12 months ago

0.5.12

12 months ago

0.5.11

12 months ago

0.5.10

1 year ago

0.5.9

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.0

1 year ago

0.5.1

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.12

1 year ago

0.3.11

1 year ago

0.3.10

1 year ago

0.3.9

1 year ago

0.3.8

1 year ago

0.3.7

1 year ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.41

1 year ago

0.2.40

1 year ago

0.2.39

1 year ago

0.2.38

1 year ago

0.2.36

1 year ago

0.2.35

1 year ago

0.2.34

1 year ago

0.2.33

1 year ago

0.2.32

1 year ago

0.2.31

1 year ago

0.2.30

1 year ago

0.2.29

1 year ago

0.2.28

1 year ago

0.2.27

1 year ago

0.2.26

1 year ago

0.2.25

1 year ago

0.2.24

1 year ago

0.2.23

1 year ago

0.2.22

1 year ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago