Code Monkey home page Code Monkey logo

pwsh-data-size-unit-measure's Introduction

Background

Size conversion in PowerShell is pretty straight forward. If you have a number in bytes and want to convert it into MB, or GB, it is as simple as typing 12345/1GB, or 12345/1MB in PowerShell prompt or script.

The problem comes when you want to convert a value from something other than bytes to something else, and being able to properly handle either base 10 (KB, MB, GB, etc.), or base 2 (KiB, MiB, GiB, etc.) size notations correctly.

Another issue is that you may want to be able to control the precision of the returned result (e.g. 0.95 instead of 0.957870483398438).

This script easily handles conversion from any-to-any (e.g. Bits, Bytes, KB, KiB, MB, MiB, etc.) It also has the ability to specify the precision of digits you want to recieve as the output.

Origin

The design ideal originally inspired from a post by Techibee posted on July 7, 2014 http://techibee.com/powershell/convert-from-any-to-any-bytes-kb-mb-gb-tb-using-powershell/2376

It has been expanded upon from there.

Installation

Download, or clone, the Convert-DataSizeUnitOfMeasure.ps1 script and read the cmdlet based help documentation for information on how to use this script.

pwsh-data-size-unit-measure's People

Contributors

void-gh avatar

Stargazers

 avatar

Watchers

 avatar

pwsh-data-size-unit-measure's Issues

Convert from or to B is wrong

Because you have a case insensitive switch for the conversion of parameter From / To, B for Byte and b for bit are the same. So If I want to convert from B to MiB, the function converts from bit to MiB.

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.