Git Product home page Git Product logo

node-gnu-parted's Introduction

All warnings have been removed. This is an experimental project. Please do not use on a disk containing important data unless you know what you're doing

node-gnu-parted

This is a port of the gnu parted compiled to WebAssembly, allowing you to edit the partition tables of block devices or disk image files. It knows nothing about the file systems on those files except to set the type of file system in the partition table metadata.

Installation

npm i gnu-parted

Usage

Pass the disk path, size of disk and command you want to run to parted.

See for how to get disk size and paths drivelist

import { parted } from 'gnu-parted'

(async () => {
  const diskPath = "DISK_PATH" // e.g. /dev/sda or /dev/disks/disk1
  const diskSize = 100000 // size in bytes of disk

  // print partition table
  await parted(diskPath, diskSize, 'print')
  
  // create gpt partition table:
  await parted(diskPath, diskSize, "mklabel gpt")

  // create new primary fat32 partition, 512MiB:
  await parted(diskPath, diskSize, "mkpart fat32 1MiB 512MiB")
})();

Note this does not create the actual file system. It just edits the partition table. You can create a file system with mkfs.

node-gnu-parted's People

Contributors

agx avatar anantn avatar aschnell avatar atodorov avatar avalluri avatar bcl avatar cjwatson avatar cristiklein avatar dannf avatar dcantrell avatar debarshiray avatar doughdemon avatar enferex avatar gedakc avatar gustavoz avatar jwrdegoede avatar kawasaki avatar knot avatar meyering avatar mfleetwo avatar nasastry avatar otavio avatar psusi avatar rossburton avatar rwmjones avatar skypher avatar slattarini avatar sriemer avatar zlinuxman avatar zwhitchcox avatar

Watchers

 avatar  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.