Installations
npm install minio
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Min. Node Version
^16 || ^18 || >=20
Node Version
20.18.1
NPM Version
10.8.2
Score
62.9
Supply Chain
98.2
Quality
89.6
Maintenance
100
Vulnerability
99.3
License
Releases
Contributors
Languages
JavaScript (55.15%)
TypeScript (44.84%)
Shell (0.02%)
Developer
Download Statistics
Total Downloads
26,663,592
Last Day
29,268
Last Week
208,593
Last Month
926,595
Last Year
9,561,489
GitHub Statistics
974 Stars
1,219 Commits
285 Forks
22 Watching
4 Branches
106 Contributors
Package Meta Information
Latest Version
8.0.3
Package Id
minio@8.0.3
Unpacked Size
2.02 MB
Size
531.68 kB
File Count
123
NPM Version
10.8.2
Node Version
20.18.1
Publised On
18 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
26,663,592
Last day
-25.2%
29,268
Compared to previous day
Last week
-7.2%
208,593
Compared to previous week
Last month
-4.6%
926,595
Compared to previous month
Last year
43%
9,561,489
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
14
Dev Dependencies
42
MinIO JavaScript Library for Amazon S3 Compatible Cloud Storage
The MinIO JavaScript Client SDK provides high level APIs to access any Amazon S3 compatible object storage server.
This guide will show you how to install the client SDK and execute an example JavaScript program. For a complete list of APIs and examples, please take a look at the JavaScript Client API Reference documentation.
This document presumes you have a working Node.js development environment, LTS versions v16, v18 or v20.
Download from NPM
1npm install --save minio
Download from Source
1git clone https://github.com/minio/minio-js 2cd minio-js 3npm install 4npm run build 5npm install -g
Using with TypeScript
minio>7.1.0
is shipped with builtin type definition, @types/minio
is no longer needed.
Initialize MinIO Client
The following parameters are needed to connect to a MinIO object storage server:
Parameter | Description |
---|---|
endPoint | Hostname of the object storage service. |
port | TCP/IP port number. Optional, defaults to 80 for HTTP and 443 for HTTPs. |
accessKey | Access key (user ID) of an account in the S3 service. |
secretKey | Secret key (password) of an account in the S3 service. |
useSSL | Optional, set to 'true' to enable secure (HTTPS) access. |
1import * as Minio from 'minio'
2
3const minioClient = new Minio.Client({
4 endPoint: 'play.min.io',
5 port: 9000,
6 useSSL: true,
7 accessKey: 'Q3AM3UQ867SPQQA43P2F',
8 secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
9})
Quick Start Example - File Uploader
This example connects to an object storage server, creates a bucket, and uploads a file to the bucket.
It uses the MinIO play
server, a public MinIO cluster located at https://play.min.io.
The play
server runs the latest stable version of MinIO and may be used for testing and development.
The access credentials shown in this example are open to the public.
All data uploaded to play
should be considered public and non-protected.
file-uploader.mjs
1import * as Minio from 'minio' 2 3// Instantiate the MinIO client with the object store service 4// endpoint and an authorized user's credentials 5// play.min.io is the MinIO public test cluster 6const minioClient = new Minio.Client({ 7 endPoint: 'play.min.io', 8 port: 9000, 9 useSSL: true, 10 accessKey: 'Q3AM3UQ867SPQQA43P2F', 11 secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG', 12}) 13 14// File to upload 15const sourceFile = '/tmp/test-file.txt' 16 17// Destination bucket 18const bucket = 'js-test-bucket' 19 20// Destination object name 21const destinationObject = 'my-test-file.txt' 22 23// Check if the bucket exists 24// If it doesn't, create it 25const exists = await minioClient.bucketExists(bucket) 26if (exists) { 27 console.log('Bucket ' + bucket + ' exists.') 28} else { 29 await minioClient.makeBucket(bucket, 'us-east-1') 30 console.log('Bucket ' + bucket + ' created in "us-east-1".') 31} 32 33// Set the object metadata 34var metaData = { 35 'Content-Type': 'text/plain', 36 'X-Amz-Meta-Testing': 1234, 37 example: 5678, 38} 39 40// Upload the file with fPutObject 41// If an object with the same name exists, 42// it is updated with new data 43await minioClient.fPutObject(bucket, destinationObject, sourceFile, metaData) 44console.log('File ' + sourceFile + ' uploaded as object ' + destinationObject + ' in bucket ' + bucket)
Run the File Uploader
1node file-uploader.mjs 2Bucket js-test-bucket created successfully in "us-east-1". 3File /tmp/test-file.txt uploaded successfully as my-test-file.txt to bucket js-test-bucket
Verify the object was created with mc
:
mc ls play/js-test-bucket
[2023-11-10 17:52:20 UTC] 20KiB STANDARD my-test-file.txt
API Reference
The complete API Reference is available here:
Bucket Operations
makeBucket
listBuckets
bucketExists
removeBucket
listObjects
listObjectsV2
listObjectsV2WithMetadata
(Extension)listIncompleteUploads
getBucketVersioning
setBucketVersioning
setBucketLifecycle
getBucketLifecycle
removeBucketLifecycle
getObjectLockConfig
setObjectLockConfig
File Object Operations
Object Operations
getObject
putObject
copyObject
statObject
removeObject
removeObjects
removeIncompleteUpload
selectObjectContent
Presigned Operations
Bucket Notification Operations
getBucketNotification
setBucketNotification
removeAllBucketNotification
listenBucketNotification
(MinIO Extension)
Bucket Policy Operations
Examples
Bucket Operations
- list-buckets.mjs
- list-objects.js
- list-objects-v2.js
- list-objects-v2-with-metadata.js (Extension)
- bucket-exists.mjs
- make-bucket.mjs
- remove-bucket.mjs
- list-incomplete-uploads.js
- get-bucket-versioning.mjs
- set-bucket-versioning.mjs
- set-bucket-tagging.mjs
- get-bucket-versioning.mjs
- set-bucket-versioning.mjs
- set-bucket-tagging.mjs
- get-bucket-tagging.mjs
- remove-bucket-tagging.mjs
- set-bucket-lifecycle.mjs
- get-bucket-lifecycle.mjs
- remove-bucket-lifecycle.mjs
- get-object-lock-config.mjs
- set-object-lock-config.mjs
- set-bucket-replication.mjs
- get-bucket-replication.mjs
- remove-bucket-replication.mjs
- set-bucket-encryption.mjs
- get-bucket-encryption.mjs
- remove-bucket-encryption.mjs
File Object Operations
Object Operations
- put-object.js
- get-object.mjs
- copy-object.js
- get-partialobject.mjs
- remove-object.js
- remove-incomplete-upload.js
- stat-object.mjs
- get-object-retention.mjs
- put-object-retention.mjs
- put-object-tagging.mjs
- get-object-tagging.mjs
- remove-object-tagging.mjs
- set-object-legal-hold.mjs
- get-object-legal-hold.mjs
- compose-object.mjs
- select-object-content.mjs
Presigned Operations
Bucket Notification Operations
- get-bucket-notification.js
- set-bucket-notification.js
- remove-all-bucket-notification.js
- listen-bucket-notification.js (MinIO Extension)
Bucket Policy Operations
Custom Settings
Explore Further
Contribute
No vulnerabilities found.
Reason
14 commit(s) and 14 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0
Reason
SAST tool is run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Info: all commits (27) are checked with a SAST tool
Reason
Found 25/28 approved changesets -- score normalized to 8
Reason
3 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/minio/minio-js/test.yml/master?enable=pin
- Warn: downloadThenRun not pinned by hash: .github/workflows/test.yml:34
- Warn: npmCommand not pinned by hash: .github/workflows/test.yml:53
- Info: 0 out of 10 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 downloadThenRun dependencies pinned
- Info: 2 out of 3 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/lint.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Score
6.1
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More