Skip to content

docs(api): tmpfile('f2.txt') example shows wrong output filename (foo.txt) #1469

@kiwigitops

Description

@kiwigitops

Problem

In docs/api.md under the tmpfile() section (line 331), the inline comment shows an output filename that doesn't match the input argument:

f1 = tmpfile()           // /os/based/tmp/zx-1ra1iofojgg
f2 = tmpfile('f2.txt')   // /os/based/tmp/zx-1ra1iofojgg/foo.txt
f3 = tmpfile('f3.txt', 'string or buffer')
f4 = tmpfile('f4.sh', 'echo "foo"', 0o744) // executable

The argument passed is 'f2.txt', but the comment shows the resulting path ending in foo.txt. Looking at the implementation in src/goods.ts, tempfile(name) returns path.join(tempdir(), name), so the result for tmpfile('f2.txt') would end in f2.txt, not foo.txt.

Expected

The comment should reflect the actual returned path based on the argument.

Suggested fix

- f2 = tmpfile('f2.txt')   // /os/based/tmp/zx-1ra1iofojgg/foo.txt
+ f2 = tmpfile('f2.txt')   // /os/based/tmp/zx-1ra1iofojgg/f2.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions