A collection of minimal binary files.
All files: https://github.com/VerifyTests/EmptyFiles/tree/main/files
- 7z (32 bytes)
- 7zip (32 bytes)
- bz2 (14 bytes)
- bzip2 (14 bytes)
- gz (29 bytes)
- gzip (29 bytes)
- tar (1.5 KB)
- xz (32 bytes)
- zip (22 bytes)
- docx (1.9 KB)
- odt (2.2 KB)
- pdf (280 bytes)
- rtf (6 bytes)
- avif (298 bytes)
- bmp (58 bytes)
- dds (136 bytes)
- dib (58 bytes)
- emf (620 bytes)
- exif (734 bytes)
- gif (799 bytes)
- heic (3.2 KB)
- heif (209 bytes)
- ico (70 bytes)
- j2c (270 bytes)
- jfif (734 bytes)
- jp2 (354 bytes)
- jpc (270 bytes)
- jpe (734 bytes)
- jpeg (734 bytes)
- jpg (734 bytes)
- jxr (300 bytes)
- pbm (8 bytes)
- pcx (131 bytes)
- pgm (12 bytes)
- png (119 bytes)
- ppm (14 bytes)
- rle (58 bytes)
- tga (543 bytes)
- tif (250 bytes)
- tiff (250 bytes)
- wdp (300 bytes)
- webp (228 bytes)
- wmp (300 bytes)
- ods (2.7 KB)
- xlsx (4.5 KB)
- odp (7.8 KB)
- pptx (13.3 KB)
Files can be consumed as a web resource using the following url:
https://github.com/VerifyTests/EmptyFiles/raw/main/index/empty.{extension}
So for example to consume a jpg use
https://github.com/VerifyTests/EmptyFiles/raw/main/index/empty.jpg
A 404 will result for non-existent files.
Ensure dotnet CLI is installed.
Install EmptyFiles.Tool
dotnet tool install -g EmptyFiles.Tool
emptyfile bmp
Creates {CurrentDirectory}/empty.bmp
emptyfile myfile.bmp
Creates {CurrentDirectory}/myfile.bmp
emptyfile path/myfile.bmp
Creates path/myfile.bmp
Creates a new empty file
AllFiles.CreateFile(pathOfFileToCreate);
Throws an exception if the extension is not known. There is also a TryCreateFile
that will return false if the extension is not known.
Use the optional useEmptyStringForTextFiles
to create a empty text file if the extension is text. The file will be UTF8 no BOM as per https://www.unicode.org/versions/Unicode5.0.0/ch02.pdf "Use of a BOM is neither required nor recommended for UTF-8".
Gets the path to an empty file for a given extension
var path = AllFiles.GetPathFor("jpg");
Throws an exception if the extension is not known. There is also a TryGetPathFor
that will return false if the extension is not known.
Returns true if the target file is an empty file.
var path = AllFiles.GetPathFor("jpg");
Assert.True(AllFiles.IsEmptyFile(path));
var temp = Path.GetTempFileName();
Assert.False(AllFiles.IsEmptyFile(temp));
Enumerates all empty files
foreach (var path in AllFiles.AllPaths)
{
Trace.WriteLine(path);
}
Use or replace a file
AllFiles.UseFile(Category.Document, pathToFile);
Assert.Contains(pathToFile, AllFiles.DocumentPaths);
https://github.com/sindresorhus/text-extensions/blob/master/text-extensions.json
Assert.True(FileExtensions.IsText("file.txt"));
Assert.False(FileExtensions.IsText("file.bin"));
Assert.True(FileExtensions.IsText(".txt"));
Assert.False(FileExtensions.IsText(".bin"));
Assert.True(FileExtensions.IsText("txt"));
Assert.False(FileExtensions.IsText("bin"));
FileExtensions.AddTextExtension("ext1");
FileExtensions.AddTextExtension(".ext2");
Assert.True(FileExtensions.IsText("ext1"));
Assert.True(FileExtensions.IsText("ext2"));
FileExtensions.AddTextExtension("ext1");
FileExtensions.AddTextExtension(".ext2");
Assert.True(FileExtensions.IsText("ext1"));
Assert.True(FileExtensions.IsText("ext2"));
FileExtensions.RemoveTextExtension("ext1");
FileExtensions.RemoveTextExtension(".ext2");
Assert.False(FileExtensions.IsText("ext1"));
Assert.False(FileExtensions.IsText("ext2"));
Hollow designed by Michael Senkow from The Noun Project.