Coder Social home page Coder Social logo

pretty_bytes's Introduction

Deprecated

This module is now merged to Deno's standard modules.

Use https://deno.land/std/fmt/bytes.ts instead.

pretty_bytes v2.0.0

ci

Convert bytes to a human readable string: 1337 → 1.34 kB

A utility for displaying file sizes for humans.

Note: This module was ported from pretty-bytes.

Usage

import { prettyBytes } from "https://deno.land/x/[email protected]/mod.ts";

prettyBytes(1337);
//=> '1.34 kB'

prettyBytes(100);
//=> '100 B'

// Display with units of bits
prettyBytes(1337, { bits: true });
//=> '1.34 kbit'

// Display file size differences
prettyBytes(42, { signed: true });
//=> '+42 B'

// Localized output using German locale
prettyBytes(1337, { locale: "de" });
//=> '1,34 kB'

See the API doc for more details.

License

MIT

pretty_bytes's People

Contributors

kt3k avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.