How to use the @seagull/commands-s3.S3.ListFiles function in @seagull/commands-s3

To help you get started, we’ve selected a few @seagull/commands-s3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seagull-js / seagull / packages / services-s3 / src / mode / base.ts View on Github external
async listFiles(bucketName: string, filePath?: string): Promise {
    const cmd = new S3C.ListFiles(bucketName, filePath)
    cmd.mode = this.mode
    return await cmd.execute() // TODO: figure out why this s3cmd has no error interface
  }
github seagull-js / seagull / packages / plugin-items / src / item.ts View on Github external
static async query(
    this: { new (...args: any[]): T },
    pattern: string
  ) {
    const matches = []
    const name = this.name
    const regexp = new RegExp(pattern, 'gi')
    const keys: string[] = await new S3.ListFiles(config.bucket, name).execute()

    for (const key of keys) {
      if (key.match(regexp)) {
        matches.push(key)
      }
    }

    return await Promise.all(
      matches.map(async match => {
        const data = await loadJSONFile(match)
        return Object.assign(Object.create(this.prototype), data) as T
      })
    )
  }
github seagull-js / seagull / packages / plugin-items / src / item.ts View on Github external
static async all(this: { new (...args: any[]): T }) {
    const name = this.name
    const keys: string[] = await new S3.ListFiles(config.bucket, name).execute()
    return await Promise.all(
      keys.map(async key => {
        const data = await loadJSONFile(key)
        return Object.assign(Object.create(this.prototype), data) as T
      })
    )
  }
github seagull-js / seagull / packages / plugin-items / src / item.ts View on Github external
static async deleteAll(this: { new (...args: any[]): T }) {
    const name = this.name
    const keys = await new S3.ListFiles(config.bucket, name).execute()

    for (const key of keys) {
      await new S3.DeleteFile(config.bucket, key).execute()
    }
  }

@seagull/commands-s3

S3 commands for the seagull framework

LGPL-3.0
Latest version published 2 years ago

Package Health Score

49 / 100
Full package analysis