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.

Fixed width format

See original GitHub issue

For progress bars, it would be nice to have an output format that is always the same width. E.g. a possible six character wide format:

            1 -> 0.0 kB
           10 -> 0.0 kB
          100 -> 0.1 kB
         1000 -> 1.0 kB
        10000 ->  10 kB
       100000 -> 100 kB
      1000000 -> 1.0 MB
     10000000 ->  10 MB
    100000000 -> 100 MB
   1000000000 -> 1.0 GB
  10000000000 ->  10 GB
 100000000000 -> 100 GB
1000000000000 -> 1.0 TB

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vladshcherbincommented, Jun 9, 2020

@gaborcsardi for your case, another option is to use filesize instead, you can set symbols there. A simple change of B to B and padStart should make your example possible.

I switched to it because I need precision https://github.com/sindresorhus/pretty-bytes/issues/57 and it kinda works fine.

0reactions
sindresorhuscommented, Jan 10, 2021

Maybe instead we could just make add a rightAlign option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixed Width Text File Definition - Softinterface
Fixed width text files are special cases of text files where the format is specified by column widths, pad character and left/right alignment....
Read more >
Why are fixed-width file formats still in use? - Stack Overflow
Fixed Width is for speed and minimal resource consumption. It can be more tedious to setup than XML. Ensuring that all systems know...
Read more >
Fixed width format - Easy Data Transform
Fixed width format is used for exchanging tabular data between programs. It is often associated with legacy systems, but is also used for...
Read more >
Fixed-length format files - IBM
Fixed-length format files use ordinal positions, which are offsets to identify where fields are within the record. There are no field delimiters.
Read more >
Importing fixed-width files - PANDA Project
Fixed-width is a file format where data is arranged in columns, but instead of those columns being delimited by a certain character (as...
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