How to use the @cumulus/ingest/aws.S3.delete function in @cumulus/ingest

To help you get started, we’ve selected a few @cumulus/ingest 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 nasa / cumulus / cumulus / tasks / archive-granules / index.js View on Github external
isPublic = true;
          break;
        default:
          bucket = process.env.private;
          break;
      }

      const p = url.parse(file.stagingFile);
      const filename = path.basename(p.path);

      log.info(`${filename} copied`, logDetails);
      await S3.copy(path.join(p.host, p.path), bucket, filename, isPublic);

      // delete the file from staging
      const deleteInfo = S3.parseS3Uri(file.stagingFile);
      await S3.delete(deleteInfo.Bucket, deleteInfo.Key);
      log.info(`${file.stagingFile} deleted`, logDetails);

      file.archivedFile = `s3://${bucket}/${filename}`;
      file.name = filename;
    }

    newFiles[key] = file;
  }

  return newFiles;
}