
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
File.path_temp
defines a temporary file path. It does not create the file. If,
after the do block, a file exists at that path then the file is deleted.
#!/usr/bin/ruby -w
require 'file/path-temp'
# call File.path_temp
File.path_temp() do |path|
# defines a path in current directory with a bunch of random numbers as
# the name e.g. ./18168068873296828
puts path
# file is *not* automatically created
puts File.exist?(path) # => false
# write to the path
File.write path, 'whatever'
# file now exists
puts File.exist?(path) # => true
end
# at this point, the file no longer exists
To put the path somewhere besides the current directory, use the root
option:
File.path_temp('root'=>'/tmp') do |path|
puts path # => e,g, /tmp/458577463617317
end
To give the path an extension, use the ext
option:
File.path_temp('ext'=>'txt') do |path|
puts path # => e,g, ./5314921893963471.txt
end
The usual:
sudo gem install path-temp
Or however you like to install gems. It's just a single file.
Open source, MIT license.
Mike O'Sullivan mike@idocs.com
version | date | notes |
---|---|---|
1.0 | Jun 29, 2023 | Initial upload. |
FAQs
Unknown package
We found that path-temp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.