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.

Option to read fields first

See original GitHub issue

Sorry to re-open an old one – but as mentioned in #43, there’s an issue when you want to process the fields of a form before you handle the file stream. Basically if the file field appears first in the upload form, you can’t read the fields until you resume() the stream.

Now let’s say I want to have a form like so:

        <input type="file" name='backupFile' accept=".tar"> Restore Backup
        <label>
        <input type="checkbox" value="drop" name="drop" checked='checked'>
          Drop Existing Data?
        </label>

AFAIK there’s no way currently to know whether I need to drop data before I pipe it to the restore handler; I’d need to move the checkbox above the file.

I prose a readFieldsFirst option to get around this.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mscdexcommented, Oct 17, 2019

@jsdevtom That doesn’t work because you have to do something with that data (imagine a multi-GB file upload that comes before non-file fields). Typically that would involve buffering in memory or writing to permanent storage somewhere. That’s not the kind of decision busboy should be making.

It’s easier/more efficient to just re-arrange the fields on the client side.

0reactions
jsdevtomcommented, Oct 18, 2019

@mscdex Got it thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing the behavior of cached fields - Apollo GraphQL
Every read function is passed two parameters: The first parameter is the field's currently cached value (if one exists).
Read more >
Set default values for fields or controls - Microsoft Support
You can set a default value for table fields set to the Text, Memo, Number, Date/Time, Currency, Yes/No, and Hyperlink data types. If...
Read more >
Retrieve selected fields from a search | Elasticsearch Guide [8.5]
Use the fields option to extract the values of fields present in the index ... The first, using the doc keyword, will cause...
Read more >
PDF form field properties, Adobe Acrobat
The Options tab appears for most form field types but the options available are unique to each type of form field.
Read more >
4. Reading Input Files - Effective awk Programming, 4th ...
If you are using gawk , see Reading an Entire File for another option. ... This example prints each record in the file...
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