https://github.com/rishantagarwal/s3-ls-lite
List Contents of S3 bucket
https://github.com/rishantagarwal/s3-ls-lite
aws contents js npm s3 s3bucket
Last synced: 2 months ago
JSON representation
List Contents of S3 bucket
- Host: GitHub
- URL: https://github.com/rishantagarwal/s3-ls-lite
- Owner: rishantagarwal
- Created: 2017-11-13T06:53:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-22T05:12:59.000Z (about 7 years ago)
- Last Synced: 2025-10-04T04:45:13.702Z (9 months ago)
- Topics: aws, contents, js, npm, s3, s3bucket
- Language: JavaScript
- Homepage:
- Size: 79.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# s3-ls-lite
List contents of an S3 bucket 'folder'. Node.js module and command line executable.
s3-ls-lite is a lighter version of s3-ls with exactly same API's
# Comparison

# Install
```sh
npm i -S s3-ls-lite
```
# Usage
```js
var s3ls = require('s3-ls-lite');
var lister = s3ls({bucket: 'my-bucket-name'});
lister.ls('/my-folder/subfolder/')
.then((data) => {
console.log(data.files); // ['my-folder/subfolder/file1','my-folder/subfolder/file2']
console.log(data.folders); // ['my-folder/subfolder/subsub1/','my-folder/subfolder/subsub2/']
})
.catch(console.error);
```
# API
The `s3ls` accepts two options:
* `bucket` - Obligatory. The S3 bucket name
* `s3` - Optional. The `aws-sdk` S3 class instance. For example: `new AWS.S3({apiVersion: '2006-03-01'})`
The `s3ls.ls(path)` function takes:
* `path` - any string. E.g.
* `"/"`, `""`, or
* `"/folder"`, `"folder/"`, `"folder"`, or
* `"/1/2/3/4"`, `"1/2/3/4/"`, `"1/2/3/4"`, etc.
# CLI
## Install
```sh
$ npm i -g s3-ls-lite
```
Usage:
```
s3-ls-lite BUCKET [PATH]
```
Example
```sh
$ s3-ls-lite my-bucket-name my-folder/subfolder/
f1/
f2/
new folder/
funny-cat-gifs-001.gif
$
```