s3-querier 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s3-querier",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Query S3-compatible storage with DuckDB and SQL",
5
5
  "type": "module",
6
6
  "main": "src/s3-querier.js",
package/src/s3/s3.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fsPromise from 'node:fs/promises';
2
2
  import { dirname } from 'node:path';
3
- import { S3Client, ListObjectsV2Command, GetObjectCommand } from '@aws-sdk/client-s3';
3
+ import { S3Client, paginateListObjectsV2, GetObjectCommand } from '@aws-sdk/client-s3';
4
4
 
5
5
  import { logger } from '../utils/logger.js';
6
6
  import { datesInRange, hoursInRange, monthsInRange, buildPath } from '../utils/file-path-builder/file-path-builder.js';
@@ -250,16 +250,9 @@ export default class S3 {
250
250
  }
251
251
 
252
252
  const files = [];
253
- let continuationToken;
254
- do {
255
- const response = await this.s3.send(
256
- new ListObjectsV2Command({ Bucket: this.bucket, Prefix: prefix, ContinuationToken: continuationToken }),
257
- );
258
- response.Contents?.forEach((content) => {
259
- files.push({ file: content.Key, size: content.Size });
260
- });
261
- continuationToken = response.NextContinuationToken;
262
- } while (continuationToken);
253
+ for await (const page of paginateListObjectsV2({ client: this.s3 }, { Bucket: this.bucket, Prefix: prefix })) {
254
+ page.Contents?.forEach((content) => files.push({ file: content.Key, size: content.Size }));
255
+ }
263
256
 
264
257
  this.listingCache.set(cacheKey, files);
265
258
  return files;
@@ -1,3 +1,3 @@
1
1
  import pino from 'pino';
2
- const logger = pino();
2
+ const logger = pino({}, process.stderr);
3
3
  export { logger };