
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
Package "Filenamer" provides a set of methods for filename manipulation. It's a very simple API for adding custom prefixes and suffixes to your base filename such as timestamps, random strings etc. Very useful when working with file uploads and you need to genereate unique filenames for your uploads.
go get -u github.com/artdarek/filenamer
package main
import (
"github.com/artdarek/filenamer"
"fmt"
)
func main() {
fn := filenamer.New("test file.jpg")
fn.CleanIt()
name := fn.Get()
fmt.Println(name)
}
package main
import (
"github.com/artdarek/filenamer"
"fmt"
)
func main() {
fn := filenamer.New("test fil e.jpg") // original filename
fn.CleanIt() // replaces whitespaces with _
fn.WithReplacement("test", "example") // will replace 'test' with 'example'
fn.WithRandomPrefix(10) // add random charset as a prefix to your file
fn.WithRandomSuffix(10) // add random charset as a suffix to your file
fn.SeparateWith("-") // set active separator for all feature modifications
fn.WithTimestamp() // add timestamp prefix
fn.WithCustomPrefix("image") // add prefix to your filename
fn.WithCustomSuffix("renamed") // add suffix to your filename
fn.WithExtension("png") // change extension of your filename
fn.WithExtensionRemoved() // removes extension from your filename
fn.HashIt() // generates md5 hash from generated filename
name := fn.Get() // Get generated filename
fmt.Println(name)
}
See some more examples in cmd/examples/main.go. You can test them in action by running following command:
go run cmd/examples/main.go
Pull requests, bug fixes and issue reports are welcome.
Before proposing a change, please discuss your change by raising an issue.
FAQs
Unknown package
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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.