How to use amplify-storage-simulator - 1 common examples

To help you get started, we’ve selected a few amplify-storage-simulator 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 aws-amplify / amplify-cli / packages / amplify-util-mock / src / storage / storage.ts View on Github external
const localEnvFilePath = context.amplify.pathManager.getLocalEnvFilePath();
    const localEnvInfo = context.amplify.readJsonFile(localEnvFilePath);
    const storageParams = context.amplify.readJsonFile(parametersFilePath);
    this.bucketName = `${storageParams.bucketName}-${localEnvInfo.envName}`;
    const route = path.join('/', this.bucketName);

    let localDirS3 = this.createLocalStorage(context, `${storageParams.bucketName}`);

    try {
      addCleanupTask(context, async context => {
        await this.stop(context);
      this.configOverrideManager = ConfigOverrideManager.getInstance(context);
      this.storageName = await this.getStorage(context);
      const storageConfig = { port, route, localDirS3 };
      this.storageSimulator = new AmplifyStorageSimulator(storageConfig);
      await this.storageSimulator.start();
      console.log('Mock Storage endpoint is running at', this.storageSimulator.url);
      await this.generateTestFrontendExports(context);
    } catch (e) {
      console.error('Failed to start Mock Storage server', e);


An S3 simulator to test S3 APIs

Latest version published 5 months ago

Package Health Score

86 / 100
Full package analysis

Popular amplify-storage-simulator functions