question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why using binary for 'application/javascript' and alike?

See original GitHub issue

I don’t understand why you use a binary mime type for

const binaryMimeTypes = [
  'application/javascript',
  'application/json',
  'application/octet-stream',
  'application/xml',
  'font/eot',
  'font/opentype',
  'font/otf',
  'image/jpeg',
  'image/png',
  'image/svg+xml',
  'text/comma-separated-values',
  'text/css',
  'text/html',
  'text/javascript',
  'text/plain',
  'text/text',
  'text/xml'
];

I think it makes sense for image/* (because png/jpg are treated as binary format by API Gateway and won’t be displayed without this) but I don’t get why you use it on application/json or application/javascript at all, and I don’t know what repercussions this may have on the behaviour of an application.

Could you explain the reason behind this? I would guess something like the following would be enough.

const binaryMimeTypes = [
  'application/octet-stream',
  'image/jpeg',
  'image/png',
  'text/comma-separated-values // unsure if that's binary format
];

Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
brettstackcommented, Mar 9, 2018

Agreed. I plan on making that change.

On Fri, Mar 9, 2018, 11:08 PM Vadorequest notifications@github.com wrote:

That is what I assumed, you use the compression express package/plugin.

Too bad it is required to manually list all MIME types because if everything is compressed, a simple * would be enough, since everything will be sent as gzip anyway.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/awslabs/aws-serverless-express/issues/131#issuecomment-371807657, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy6l532uUPyn4s15QWiOC0_Nfr0JMf0ks5tcn7dgaJpZM4SkDt1 .

0reactions
brettstackcommented, Apr 10, 2018

Added in #136

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why using binary for 'application/javascript' and alike? #131
I think it makes sense for image/* (because png/jpg are treated as binary format by API Gateway and won't be displayed without this)...
Read more >
Using Binary Data with Front-End JavaScript and the Web
A comprehensive write-up on different ways to convert and use binary data in front-end JavaScript code, web browser APIs, and even your ...
Read more >
How are efficient data structures like binary search tree ...
In my college, I learned how to define data structures like binary trees and graphs. We were made to write c++ programs that...
Read more >
Creating Javascript Binaries For Electron - Jeff Robbins
But if we want to create a software product, Javascript is at a disadvantage because we cannot hide our code. By contrast, compiled...
Read more >
Sending and Receiving Binary Data - Web APIs | MDN
Sending typed arrays as binary data​​ You can send JavaScript typed arrays as binary data as well. This is building a 512-byte array...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found