question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

By default, "." entry added

See original GitHub issue

When running on Linux system the pack example tar.pack('./my-directory').pipe(fs.createWriteStream('my-tarball.tar')), the generated tar contains a “.” entry.

tar -tf my-tarball.tar . my-file.txt another-file.txt

This entry should not be included.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bradchristensencommented, Jun 19, 2017

Thanks for the workaround @Chcap! 😃 For anyone looking for a quick solution, my code now looks something like this:

const fs = require('fs');
const { promisify } = require('util'); /* Note that this requires Node.js 8+ */
const tar = require('tar-fs');

const readdir = promisify(fs.readdir);

/* ... */

const entries = await readdir('/path/to/dir');
const tarStream = tar.pack('/path/to/dir', { entries });

/* Stream tarStream to somewhere, e.g. to a file:
 * tarStream.pipe(fs.createWriteStream('file.tar')); */

Note also that the await syntax requires this code to run inside an async function rather than at the top-level of a module. You can achieve this just by encapsulating it in a function and executing that function, e.g.:

async function packTar() {
    const entries = await readdir('/path/to/dir');
    const tarStream = tar.pack('/path/to/dir', { entries });

    /* ... */
}

packTar();
1reaction
Chcapcommented, Feb 9, 2016

No, not breaking, but it can be confusing for a user when finding a tar file with these strange “.” entry. I agree, it is a minor issue 😃

The workaround I used is to tar parent directory and to use my target directory as unique entry.

A solution would be, if no entries provided, to populate the queue with the list of files from readdir instead of single entry “.”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL DEFAULT Constraint - W3Schools
The DEFAULT constraint is used to set a default value for a column. The default value will be added to all new records,...
Read more >
How to set default text for a Tkinter Entry widget - Stack Overflow
Use Entry.insert . For example: try: from tkinter import * # Python 3.x except Import Error: from Tkinter import * # Python 2.x...
Read more >
How to Set the Default Text of Tkinter Entry Widget?
Therefore, default text must be added to any text field in Tkinter using the following methods: Insert method; stringvar method. Method 1: Using ......
Read more >
Set default values for fields or controls - Microsoft Support
Understand default values ... You add a default value to a table field or form control whenever you want Access to enter a...
Read more >
How to Add a Default Value to a Column in MySQL - PopSQL
To add a default value to a column in MySQL, use the ALTER TABLE ... ALTER ... SET DEFAULT command: --Example: Products have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found