npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vdisk

v0.1.2

Published

virtual disk toolset for virtual machine

Downloads

30

Readme

vdisk-tools

操作虚拟磁盘文件(virtual disk)的工具。 目前支持的虚拟磁盘文件规范如下表:

spec | type | support --- | :---: | :---: vhd | fixed | yes vhd | dynamic | yes vhd | differencing | no vdi | fixed | no (coming soon) vdi | dynamic | no (coming soon) vmdk | fixed | no vmdk | dynamic | no

Install

npm install -g vdisk

Example

向虚拟磁盘的启动扇区(逻辑0扇区)写入程序

# 将 boot.bin 程序写入 disk.vhd 文件的启动扇区
vdisk write disk.vhd boot.bin

向虚拟磁盘的指定扇区处写入数据

# 从虚拟磁盘 disk.vhd 的第100扇区(以0开头)开始,写入 data.bin 文件内容
vdisk write disk.vhd data.bin -s 100

按照LBA逻辑扇区号读取磁盘内容

# 从虚拟磁盘 disk.vhd 的第100扇区(以0开头)处开始,读取2个扇区的内容
vdisk read disk.vhd -s 100 -c 2

查看虚拟磁盘文件的header/footer结构

vdisk inspect disk.vhd

清空虚拟磁盘文件

vdisk clear disk.vhd

生成虚拟磁盘内容的结构图(coming soon)

vdisk graph disk.vhd

查看帮助

vdisk --help

# 输出
Usage: vdisk [options] [command]

Options:
  -v, --version                output the current version
  -h, --help                   display help for command

Commands:
  inspect <vhd>                inspect virtual disk file structure
  read [options] <vhd>         read sector data from virtual disk file
  write [options] <vhd> <bin>  write special binary file to virtual disk file
  clear <vhd>                  clear virtual disk file content
  help [command]               display help for command

相关规范文档

  1. Virtual Hard Disk Image Format Specification(2006)
  2. Virtual Hard Disk v2 (VHDX) File Format
  3. All about VDIs
  4. VDI Storage's Source
  5. VDI's Kaitai Struct

为什么写这个项目?

最近在B站上看了几个计算机原理方面的视频,突然就来了兴趣,从三极管开始,搭建与/或/非/异或/同或等基本门电路,实现8位全加器等等,一发不可收拾,于是又买了《X86汇编语言:实模式到保护模式》系列课程,开始重新学习x86汇编。
这个课程需要用到作者写的一个FixVhdWr.exe的工具,用来将汇编写的引导程序写入虚拟磁盘文件的MBR,从而在虚拟机上启动来查看效果,然而这个工具只有Windows版本,我身边又没有Windows操作系统,因此,就搜了一下vhd文件的格式规范,用nodejs重新实现了相关功能。
作者为了教学目的只实现了Fixed VHD文件的写入,课程中所有的汇编程序都是写入到Fixed VHD磁盘上面的,我为了学习目的,自己实现了FixedDynamic两种格式的VHD文件,并且写了read/write/clear/inspect等多个命令,算是实现了一个较完整的操作虚拟磁盘文件的工具。