frida-fs 5.0.2 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -329,12 +329,18 @@ function readlinkSync(path) {
329
329
  return buf.readUtf8String(n);
330
330
  }
331
331
 
332
- function unlinkSync(path) {
333
- const {unlink} = getApi();
332
+ function rmdirSync(path) {
333
+ const pathStr = Memory.allocUtf8String(path);
334
334
 
335
+ const result = getApi().rmdir(pathStr);
336
+ if (result.value === -1)
337
+ throw new Error(getErrorString(result.errno));
338
+ }
339
+
340
+ function unlinkSync(path) {
335
341
  const pathStr = Memory.allocUtf8String(path);
336
342
 
337
- const result = unlink(pathStr);
343
+ const result = getApi().unlink(pathStr);
338
344
  if (result.value === -1)
339
345
  throw new Error(getErrorString(result.errno));
340
346
  }
@@ -649,6 +655,7 @@ const apiSpec = [
649
655
  ['readdir', NF, 'pointer', ['pointer']],
650
656
  ['readdir$INODE64', NF, 'pointer', ['pointer']],
651
657
  ['readlink', SF, ssizeType, ['pointer', 'pointer', sizeType]],
658
+ ['rmdir', SF, 'int', ['pointer']],
652
659
  ['unlink', SF, 'int', ['pointer']],
653
660
  ['stat', SF, 'int', ['pointer', 'pointer']],
654
661
  ['stat64', SF, 'int', ['pointer', 'pointer']],
@@ -709,6 +716,7 @@ export function createWriteStream(path) {
709
716
  export const readdir = callbackify(readdirSync);
710
717
  export const readFile = callbackify(readFileSync);
711
718
  export const readlink = callbackify(readlinkSync);
719
+ export const rmdir = callbackify(rmdirSync);
712
720
  export const unlink = callbackify(unlinkSync);
713
721
  export const stat = callbackify(statSync);
714
722
  export const lstat = callbackify(lstatSync);
@@ -719,6 +727,7 @@ export {
719
727
  list,
720
728
  readFileSync,
721
729
  readlinkSync,
730
+ rmdirSync,
722
731
  unlinkSync,
723
732
  statSync,
724
733
  lstatSync,
@@ -736,6 +745,8 @@ export default {
736
745
  readFileSync,
737
746
  readlink,
738
747
  readlinkSync,
748
+ rmdir,
749
+ rmdirSync,
739
750
  unlink,
740
751
  unlinkSync,
741
752
  stat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-fs",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "description": "Create a stream from a filesystem resource",
5
5
  "main": "index.js",
6
6
  "type": "module",