Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like the part where you bulked up the S3 part unnecessarily and hid the extra stuff you needed for yours that S3 doesn’t need.

Sorry, but your code examples are a flat out lie.



I disagree. Only an import statement is missing from both examples. Which parts is missing in your opinion?


> Only an import statement is missing from both examples.

    import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'; 
Really? C'mon. It's YOUR examples on YOUR site.

Regardless, that's not even what I'm worried about.

The part where you need a key for this service and don't need any of that for S3.

Sorry, but now that means I have to handle credentials with this service, which is something I like to avoid as much as possible.

Let's put it this way.

I can spin up an AWS instance right now and do

    await s3lib.set('image.png');
and it works.

But if I do:

    await f0.set('image.png');
I also need to find a way to properly handle this extra token.

And my issue with that is this:

    const s3 = new S3Client({
      region: region,
      credentials: {
          accessKeyId: accessKeyId,
          secretAccessKey: secretAccessKey
      }
    });
You don't need that.

But here is the fun part. Here is the AWS code you need to upload a file and have it available.

    await s3.send(new PutObjectCommand({Bucket: 'my-bucket',Key: 'image.png',Body: myFile}));
And that's it. Full stop. No key to muck about with.

versus

    await f0.set('image.png', myFile);
But..., you also need to set the key, so....

    SOME_ENV_VAR_FOR_YOUR_SERVICE=howeverlongthisisyouneedtomakesureitgoessomewhere node app.js
And, honestly, we know that's not even the same thing as what I have up there for AWS.

Or...

    const f0 = new File0({secretKey="howeverlongthisisyouneedtomakesureitgoessomewhere"})
    await f0.set('image.png', myFile);
Or...

    const config = {
        secretKey: "howeverlongthisisyouneedtomakesureitgoessomewhere"
    };
    const f0 = new File0();
    await f0.set('image.png', myFile);
    await f0.publish('image.png');
Listen, whatever. I'm tired of people being deceptive to try and sell products to programmers. I get it. You are after the lowest common denominator. Someone who actually doesn't know AWS, S3, or anything about Roles. Someone who could set that up in minutes. Fine, I get it. Convenience is real. Just own up to the fact that your examples are purposely bloated on one end and shamelessly thinned on the other end.

You literally add extra stuff on the AWS side and remove needed stuff on your side. To me, that's a lie.


I will kindly ignore the mental breakdown.

About the rest: For s3 you need to instantiate the client, and the only part you're correct about is that the client credentials can be also auto detected from env vars.

Let's boil the rest down: - For S3 you will need to add 2 env vars: AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY_SECRET. In case you don't have other AWS keys in your env for other services this will be auto detected by the client. (Still needs to be instantiated), so you can cross off the 2 lines for creadentials.

- For FILE0 you need to add 1 env var: F0_SECRET_KEY. Then import the client which is autodetecting your env. ``` import {f0} from 'file0';

f0.set('myshit.png', myFile); ```

I'll let everyone be the judge of which one is simpler for them. And you should also use whichever you like more. I will sleep good at night either way and keep using file0.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: