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.

Add ability to easily cleanup

See original GitHub issue

Issuehunt badges

Offer both cleanup when the process exits, manual cleanup method call, and also a context-based cleanup, for examples:

tempy.context(directory => {
	// Use the temp
});

// Temp directory is cleaned up here.

(The temp directory is cleaned up after the callback scope.) (The above is just an idea. Please consider a better API and naming.) (The context callback should also be able to be an async function.)

Inspiration: Python Context Managers


If you decide to work on this, please put a good effort into the implementation, docs (and TS definition), and tests.


IssueHunt Summary

richienb richienb has been rewarded.

Backers (Total: $80.00)

Submitted pull Requests


Tips

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sindresorhuscommented, Aug 13, 2020

The first suggestion is not desirable as it would complicate the TS types and it would be better to just add a .cleanup() method:

const tempy = require("tempy");

const tempFile = tempy.file();

// Use tempFile...

tempy.cleanup(tempFile);

The second suggestion would also not be better than what’s above.

I think the last suggestion there is the best.

0reactions
issuehunt-app[bot]commented, Sep 13, 2020

@sindresorhus has rewarded $72.00 to @richienb. See it on IssueHunt

  • 💰 Total deposit: $80.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $8.00
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cleanup: Phone Storage Cleaner 4+ - App Store
Download Cleanup: Phone Storage Cleaner and enjoy it on your iPhone, iPad, and iPod touch. ... Cleanup is here to make this process...
Read more >
6 Easy Tips for Simplifying ADHD and House Cleaning
In this article, we want to provide you a boost to your confidence in your ability to manage ADHD and house cleaning. You...
Read more >
Disk cleanup in Windows - Microsoft Support
In the search box on the taskbar, type disk cleanup, and select Disk Cleanup from the list of results. Select the drive you...
Read more >
Clean Up Your iPhone or iPad IN UNDER 10 MINUTES!!!
Today David's showing you how to clean up your iPhone or iPad in UNDER 10 MINUTES! No 3rd party software! Just a bunch...
Read more >
11 Cleaner Apps to Free up Space on iPhone - Geekflare
Clean Master – Super Cleaner has the power to clean up the gallery quickly with a few clicks. It can organize a messy...
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