8000 GitHub - phi-ag/rvt at v0.0.2
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

phi-ag/rvt

Repository files navigation

@phi-ag/rvt

Version Coverage Downloads Size

Parse Revit file format

Usage

pnpm add @phi-ag/rvt

Examples

Node.js / Deno / Bun

import { basicFileInfo, thumbnail } from "@phi-ag/rvt";
import { openPath } from "@phi-ag/rvt/node";

const file = await openPath("family.rfa");
const info = await basicFileInfo(file);
const image = await thumbnail(file);

console.log(info);

Browser

import { basicFileInfo, openFile, thumbnail } from "@phi-ag/rvt";

// Get a file handle from <input type="file" accept=".rfa,.rvt" />
// see https://developer.mozilla.org/en-US/docs/Web/API/File_API/Using_files_from_web_applications
const selectedFile = document.getElementById("input").files[0];

const file = await openFile(selectedFile);
const info = await basicFileInfo(file);
const image = await thumbnail(file);

console.log(info);

If you don't want to throw errors, use tryOpenPath, tryOpenFile, tryBasicFileInfo and tryThumbnail

tryOpenPath("valid.rvt");
// => { ok: true; data: ... }

tryOpenPath("invalid.rvt");
// => { ok: false; error: "Error message" }

tryBasicFileInfo("valid.rvt");
// => { ok: true; data: { version, build, ... } }

tryBasicFileInfo("invalid.rvt");
// => { ok: false; error: "Error message" }

About

Parse Revit file format

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0