Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",

"name": "Node.js",
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",

"customizations": {
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
name: Unit Tests
strategy:
matrix:
node-version: [20, 22, 24]
node-version: [22, 24]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22.17.0
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ unRtf

As mentioned in the note block at the top of this README, the `noPictures` option does not remove images
when used with UnRTF < v0.20.4 and will write them to the current working directory.
To remove images generated by UnRTF it is recommended to use a globbing module such as [glob](https://www.npmjs.com/package/glob) in conjunction with the `node:fs/promises` module to find and remove them:
To remove images generated by UnRTF it is recommended to use globbing in conjunction with the `node:fs/promises` module to find and remove them:

```js
import { unlink } from "node:fs/promises";
import { glob, unlink } from "node:fs/promises";
import { UnRTF } from "node-unrtf";
import { glob } from "glob";

const file = "test/files/test-rtf-complex.rtf";
const unRtf = new UnRTF();
Expand All @@ -111,8 +110,11 @@ const options = {

await unRtf.convert(file, options);

const files = await glob("*.{emf,wmf}");
await Promise.all(files.map((filed) => unlink(filed)));
const files = [];
for await (const filePath of glob("*.{emf,wmf,png}")) {
files.push(filePath);
}
await Promise.all(files.map((filePath) => unlink(filePath)));
```

## Contributing
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"author": "Frazer Smith <frazer.dev@icloud.com>",
"funding": "https://github.com/sponsors/Fdawgs",
"engines": {
"node": ">=20"
"node": ">=22.17.0"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
Expand Down Expand Up @@ -86,7 +86,6 @@
"@types/semver": "^7.7.0",
"eslint": "^9.31.0",
"eslint-plugin-jest": "^29.0.1",
"glob": "^13.0.0",
"jest": "^30.0.5",
"licensee": "^12.0.1",
"prettier": "^3.6.2",
Expand Down
10 changes: 6 additions & 4 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"use strict";

const { execFile, spawnSync } = require("node:child_process");
const { unlink } = require("node:fs/promises");
const { glob, unlink } = require("node:fs/promises");
const { join, normalize, sep } = require("node:path");
const { platform } = require("node:process");
const { promisify } = require("node:util");
Expand All @@ -18,7 +18,6 @@ const {
it,
jest,
} = require("@jest/globals");
const { glob } = require("glob");
const generateCombos = require("./utils/gen-combos");

const execFileAsync = promisify(execFile);
Expand Down Expand Up @@ -63,8 +62,11 @@ const testBinaryPath = getTestBinaryPath();
describe("Node-UnRTF module", () => {
afterEach(async () => {
// Remove leftover test files
const files = await glob("*.{emf,wmf,png}");
await Promise.all(files.map((filed) => unlink(filed)));
const files = [];
for await (const filePath of glob("*.{emf,wmf,png}")) {
files.push(filePath);
}
await Promise.all(files.map((filePath) => unlink(filePath)));
});

describe("Constructor", () => {
Expand Down
Loading