Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading file to AWS s3, Bun is slower than Node #11128

Closed
lnlife opened this issue May 16, 2024 · 1 comment
Closed

Uploading file to AWS s3, Bun is slower than Node #11128

lnlife opened this issue May 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lnlife
Copy link

lnlife commented May 16, 2024

What version of Bun is running?

1.1.8

What platform is your computer?

Linux 6.5.0-28-generic x86_64 x86_64

What steps can reproduce the bug?

Run the following script:

import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
import * as fs from 'fs';
import * as path from 'path';
const config = {
  key: "",
  secret: '',
  bucket: "",
  endpoint: "",
}

const s3Client = new S3Client({
  endpoint: config.endpoint,
  region: "auto",
  credentials: {
    accessKeyId: config.key,
    secretAccessKey: config.secret,
  }
});
let bucketName = config.bucket

async function uploadFile(filePath) {
  const fileName = path.basename(filePath);
  const startTime = new Date().getTime();
  const fileContent = fs.readFileSync(filePath);

  const params = {
    Bucket: bucketName,
    Key: fileName,
    Body: fileContent
  };

  try {
    await s3Client.send(new PutObjectCommand(params));
    const elapsedTime = new Date().getTime() - startTime;
    console.log(`Successfully uploaded ${fileName} to ${bucketName} in ${elapsedTime} ms`);
  } catch (err) {
    console.error(`Failed to upload file: ${err}`);
  }
}

uploadFile('./test.jpg');

What is the expected behavior?

Uploading speed should be same with Node.

What do you see instead?

No response

Additional information

No response

@lnlife lnlife added the bug Something isn't working label May 16, 2024
@Electroid
Copy link
Contributor

Duplicate of #7428

@Electroid Electroid marked this as a duplicate of #7428 May 16, 2024
@Electroid Electroid closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants