• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript s3.createClient函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中s3.createClient函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createClient函数的具体用法?TypeScript createClient怎么用?TypeScript createClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了createClient函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: task

task('demos.download', (done: Function) => {
  if (!process.env.AWS_KEY || !process.env.AWS_SECRET) {
    return new Promise((resolve) => {resolve();});
  }

  let client = s3.createClient({
    s3Options: {
      accessKeyId: process.env.AWS_KEY,
      secretAccessKey: process.env.AWS_SECRET
    },
  });

  let params = {
    localDir: join(process.cwd(), 'dist', 'demos', 'src'),
    s3Params: {
      Bucket: "ionic-demos",
    },
  };

  let uploader = client.downloadDir(params);

  return new Promise((resolve, reject) => {    
    uploader.on('error', function(err) {
      console.error("s3 Download Error:", err.stack);
      reject();
    });
    uploader.on('end', function() {
      console.log("Demos downloaded from s3");
      resolve();
    });
  });
})
开发者ID:aggarwalankush,项目名称:ionic,代码行数:32,代码来源:demos.prod.ts


示例2: pushToS3

export default function pushToS3(NEW_TAG: string) {
  console.log("Start to upload bundled javascript files to S3");

  const s3Client = s3.createClient(DeployConfig.S3_CLIENT_OPTIONS);

  let uploader: DeployConfig.IS3ClientUploaderOptions;

  return new Promise((resolve, reject) => {
    uploader = s3Client.uploadDir({
      localDir: DeployConfig.APP_DEST,
      s3Params: {
        Bucket: DeployConfig.AWS_S3_BUCKET,
        Prefix: `${DeployConfig.AWS_S3_FOLDER_PREFIX}/${NEW_TAG}`,
        CacheControl: "public, max-age=604800",
        ACL: "public-read",
      },
    });

    uploader.on("error", (err: Error) => {
      console.error("unable to sync:", err.stack);
      reject(err);
    });
    uploader.on("progress", () => {
      console.log("progress", uploader.progressAmount, uploader.progressTotal);
    });
    uploader.on("end", () => {
      console.log("END to upload dist files to S3");
      resolve();
    });
  }).catch(err => {
    console.error(err);
  });
}
开发者ID:academey,项目名称:coinone_dev_interview,代码行数:33,代码来源:pushToS3.ts


示例3: Promise

    return new Promise((resolve, reject) => {
      const s3Client = s3.createClient(DeployConfig.S3_CLIENT_OPTIONS);

      const params = {
        Bucket: DeployConfig.AWS_S3_BUCKET,
        CopySource: `${DeployConfig.AWS_S3_BUCKET}/${DeployConfig.AWS_S3_FOLDER_PREFIX}/${NEW_TAG}/bundle.js`,
        Key: "bundle.js",
        ACL: "public-read",
      };

      s3Client.copyObject(params, (err: Error, res: any) => {
        if (err) {
          console.error("copy to root has failed!", err);
          reject(err);
        } else {
          resolve(res);
        }
      });
    });
开发者ID:academey,项目名称:coinone_dev_interview,代码行数:19,代码来源:copyJsToRoot.ts


示例4: uploadToS3

function uploadToS3(path) {
  // fail silently if envars not present
  if (!process.env.AWS_KEY || !process.env.AWS_SECRET) {
    return new Promise((resolve) => {resolve();});
  }

  let client = s3.createClient({
    s3Options: {
      accessKeyId: process.env.AWS_KEY,
      secretAccessKey: process.env.AWS_SECRET
    },
  });

  // get demo name from path
  let demo = path.split('/')[path.split('/').length - 2];

  let params = {
    localDir: path.replace('tsconfig.json',''),
    deleteRemoved: true, 
    s3Params: {
      Bucket: "ionic-demos",
      Prefix: demo,
    },
  };

  var uploader = client.uploadDir(params);

  return new Promise((resolve, reject) => {    
    uploader.on('error', function(err) {
      console.error("s3 Upload Error:", err.stack);
      reject();
    });
    uploader.on('end', function() {
      console.log(demo, " demo uploaded to s3");
      resolve();
    });
  });
}
开发者ID:aggarwalankush,项目名称:ionic,代码行数:38,代码来源:demos.prod.ts



注:本文中的s3.createClient函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript sails.log类代码示例发布时间:2022-05-25
下一篇:
TypeScript rxui.ReactiveCommand类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap