All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
0.5.1 (2026-12-02)
Bug Fixes
- leave keys with an empty segment or a leading slash out of listings (#179) (42e0b43)
- list a name that's a file and a directory once per type on S3 and Azure (#176) (39f10e2)
- local: keep the content on a move onto the file the source links to (#177) (923b60c)
- local: remove every name in the root on rm_rf and leave .fil- files out of the count (#178) (0fe4070)
- local: return a read error while computing a checksum from Fil.stat/3 (#173) (a45aa03)
- local: return an error when streaming or reading a range of a file that can't seek (#175) (c7e1ffc)
- local: return Fil.AccessDeniedError from rm_rf of a directory it can't read or empty (#182) (0a202d3)
- pass a size a plugin declares after update_content/2, also when it equals the found size (#183) (2b5498e)
- raise ArgumentError for a reversed range or a pattern that isn't UTF-8 in Fil.wildcard/3 (#184) (28fee8f)
- refuse a negative client size in Fil.LiveView.external/2 instead of crashing the LiveView (#185) (0258de7)
- zip: leave out entries with more than 64 path levels (#181) (96d4d25)
0.5.0 (2026-12-01)
⚠ BREAKING CHANGES
Fil.Adapter.signed_upload/3gets:signed_atand:expires_at(both aDateTime) inoptsinstead of:expires_in. Adapters that implement it sign with those and return both in the result, which has a new:signed_atfield (Fil.signed_upload/0).Fil.Plugin.URLraisesNimbleOptions.ValidationErrorfor a:secretshorter than 32 bytes. Use at least 32 random bytes, such as the output ofmix phx.gen.secret.Fil.Adapter.stream/3returns{:ok, stream, %Fil.Stat{}}instead of{:ok, stream, size}. An adapter outsideFilthat still returns an integer size makesFil.stream/3and copies across disks raiseArgumentError. Return a%Fil.Stat{}with at least:sizeand:content_type(nilwhere unknown).- Paths with control characters, such as a tab or a newline, fail with
Fil.InvalidPathError, and listings leave out stored files with such names. Refs to those files, for example in an Ecto field, stop working. - The disk root
".", and paths that normalize to it such as"", fails withFil.InvalidPathError(:eisdir) when it's used as a file: in a read, a write,Fil.rm/2, either side of a copy or a move, or a URL.
Features
- compute the signing time of signed uploads once in Fil (#151) (e4fae15)
- require a secret of at least 32 bytes in Fil.Plugin.URL (#145) (2ddd3ce)
Bug Fixes
- answer a copy or move onto its own path the same way on every adapter (#116) (dfa3569)
- azure: decode blob names that listings mark as encoded (#137) (06aaa88)
- azure: return a conflict when another upload to the same path commits first (#109) (080ed71)
- cut 206 downloads to the range and cap error bodies of S3 and Azure Blob (#143) (e872575)
- ecto: see a ref to the same path on another disk as a change (#130) (6e9173f)
- end idle cloud download streams after :stream_idle_timeout (#156) (98728fb)
- find shipped plugins by their callback, whatever name they're attached under (#144) (0396f51)
- keep the content type on a copy across disks (#153) (5e2d446)
- keep the file on a move onto its own path from another disk of the same storage (#98) (569bf0f)
- keep the file when a copy or a move between disks with overlapping roots names it twice (#146) (6964cda). Adapters outside
Filimplement the new optionalFil.Adapter.location/2to get this. - keep the file when a plugin refuses an empty stream on S3 or Azure Blob (#102) (b928994)
- list only the directory in rm_rf on S3 and Azure Blob (#128) (8f64178)
- live_view: show the size and type messages for Fil.Plugin.Validation's errors (#132) (8b2c3db)
- local: accept paths on a disk with the root / (#114) (099b520)
- local: keep a file's permissions when a write replaces it (#133) (ae0ab5c)
- local: replace the destination of a copy instead of writing into it (#104) (5bf4dc6)
- local: report a failed move on the destination when the destination is the problem (#129) (41c55d6)
- local: stay out of symlinked directories in recursive listings and rm_rf counts (#111) (fe07c77)
- local: treat FIFOs, sockets and devices as missing (#103) (3612515)
- plug: keep query names with brackets as they were signed (#134) (7fef94f)
- plug: keep signed downloads private to caches when the application set another cache-control (#148) (d0a8c65)
- plug: match an at: path that needs percent-encoding (#110) (bd0795c)
- print a ref's path quoted and escaped when it holds a control character (#149) (03509d8)
- refuse paths with control characters (#108) (3a6c2ad)
- refuse storage responses that hide a DTD in UTF-16 (#106) (c5d63ad)
- refuse the disk root as a file, so S3 never deletes or creates the bucket for it (#141) (bb6605d)
- return Fil.UnavailableError when the connection pool has no free connection (#155) (5da00a6)
- s3: copy and move objects over 5 GiB (#154) (4862eda)
- s3: list keys URL-encoded, so a key with a control character doesn't break listings (#135) (5892aff)
- s3: report a wrong region only for the errors that mean one (#138) (311b672)
- thumbnails: attach Fil.Plugin.Validation before Fil.Plugin.Thumbnails (#101) (2450ab1)
- thumbnails: refuse content in formats outside :extensions, such as SVG (#127) (1077dd5)
- validation: keep JavaScript out of content type wildcards (#96) (d971368)
- validation: refuse a declared content type that lists several types (#107) (a367ef5)
- zip: fail a part of an entry whose local header reaches past it (#97) (1330adf)
- zip: leave out entries with names over 1,024 bytes (#100) (61d7786)
- zip: read archives with an encrypted stored entry (#112) (fe793b7)
Performance Improvements
0.4.0 (2026-11-30)
⚠ BREAKING CHANGES
Fil.Adapter.signed_url/3and plugins that handle the:signed_urloperation get:signed_atand:expires_at(bothDateTime) in the options instead of:expires_in. Adapters sign with those values instead of reading the clock.
Features
- create Azure containers and S3 buckets for local setups (#88) (3a6340e)
- let Fil.signed_url/3 take the signing time (#89) (05dcbc6)
Bug Fixes
0.3.0 (2026-11-30)
Added
Fil.Adapter.Zipreads the files of a zip archive on any disk, read-only. It reads only the parts of the archive it needs, with ranged reads, so a file in a large archive on S3 costs a few requests. It reads stored and deflated entries and Zip64 archives, checks each whole entry against its CRC-32, never inflates an entry past its declared size, and leaves out entries whose names escape the archive's root. Every change returnsFil.AccessDeniedErrorwithreason: :read_only. (#48)Fil.Adapter.AzureBlobstores files in Azure Blob Storage and Azurite, signed with the account key (Shared Key) or sent with a SAS token. Streams without a size are uploaded in blocks and committed at the end,checksum:is stored as blob metadata, andFil.signed_url/3andFil.signed_upload/3return service SAS URLs. A SAS can't bind the content type, the size or extra query parameters, soquery:returns aFil.UnsupportedError, andFil.LiveViewchecks the content type and the size of a direct upload when it's consumed, andFil.Plugin.Validationrefuses to sign an upload whose size or type its rules need. The Livebook smart cell builds Azure disks too. (#42)Fil.signed_upload/3signs a direct upload and returns a map with the method, the URL, the headers and form fields the client has to send, and when the URL expires. They come from the disk, so a client passes them on as they are, andFil.LiveView's uploader sends a form when the method is:post. Its options are those of an upload URL before (expires_in:,content_type:,size:,if_exists:andquery:), andFil.disk/1takessigned_upload:with defaults forexpires_in:andif_exists:. Adapters sign uploads with the new optional callbackFil.Adapter.signed_upload/3and say withFil.Adapter.binds_uploads?/1whether the storage enforces the signed size and type, and plugins see uploads as the:signed_uploadop. (#42)Fil.Adapter.Nullis a disk that stores nothing: writes succeed and drop the content, and every file is missing. It's for dry runs, environments with storage turned off and tests that don't read files back. It reads a stream to the end, so a failing stream or a plugin that refuses the content still fails the write. (#46)Fil.Plugin.ReadOnlylets reads, listings and URLs pass and refuses every other operation (writes, deletes, copies and moves within the disk, signed uploads) withFil.AccessDeniedErrorandreason: :read_only. A copy to another disk works. (#45)
Changed
Fil.signed_url/3signs downloads only, and no longer takesmethod:,content_type:,size:orif_exists:. Sign uploads withFil.signed_upload/3instead. Thesigned_url:option ofFil.disk/1no longer takesif_exists:, which moved tosigned_upload:.Fil.Plugin.Validationchecks uploads on the:signed_uploadop. (#42)Fil.InvalidRequestErroris split by what the caller can do about it. A path the disk can't use (:ebadpath,:eisdir,:enotdir, a name that's too long, a symlink loop, S3'sKeyTooLongError) is the newFil.InvalidPathError. Content the disk refuses is aFil.InvalidContentErrorwherever the refusal comes from: content over the storage's size limit,:too_many_parts,Fil.Plugin.Thumbnailsfor a file that isn't an image, andFil.LiveView's:extension,:too_large,:sizeand:content_type. S3'sInvalidRequestand Azure'sInvalidHeaderValue,InvalidQueryParameterValueandOutOfRangeInputare aFil.UnknownError.Fil.Plugkeeps its statuses, and answers a content error with the body "the content was rejected" wherever it comes from. (#77)Fil.Adapter.S3handles a copy or a move onto itself like the other adapters: it leaves the file as it is, and returnsFil.AlreadyExistsErrorwithif_exists: :error, instead of S3'sInvalidRequest. (#77)
Fixed
Fil.Plugserves the right ranges with a plugin that changes the size of reads, once the plugin follows the new rule for sizes:Fil.stat/3andFil.ls/3report the size of the content asFil.read/3returns it, so such a plugin setssizein its:statand:lsresults to the size it delivers, or tonilwhen it can't know it (see Ranges). A file without a size gets a200with the whole file and noaccept-ranges, andFil.LiveViewno longer refuses a direct upload without a size as larger thanmax_file_size:. (#75)
Security
Fil.PlugandFil.Plug.send_filesendx-content-type-options: nosniffwith every response, and send HTML, XML, SVG and JavaScript files, and files without a valid type, asapplication/octet-streamwithcontent-disposition: attachment, so an uploaded file can't run scripts on your application's domain. With aninlinedisposition, such a file keeps its type and getscontent-security-policy: sandbox, so the browser shows it without running its scripts. The newactive_types:option changes the list (Fil.Plug.default_active_types/0returns the default), andactive_types: []sends every file as stored. (#47)
0.2.0 (2026-10-06)
Added
Fil.Plug.send_file/3sends a file from a disk as the response of a controller, on every adapter, with the sameetag,304, ranges and streaming as the mounted plug, pluscontent_type:anddisposition:. A missing file returns the error before anything is sent, so anaction_fallbackcan answer it. (#39)Fil.disk/1takessigned_url:with default options forFil.signed_url/3on that disk (expires_in:,disposition:andif_exists:), so a disk from config can give every signed URL a day and every download the:attachmentdisposition. The options of a call replace them, and a default that doesn't fit the method (a disposition on an upload) is left out. (#37)Fil.ls/3takestype: :regularortype: :directoryto list only files or only directories. Withrecursive: true,type: :directorylists every directory of the subtree. (#40)Fil.wildcard/2,3lists the paths of a disk that match a pattern, such as"media/*/{withText,withoutText}", withPath.wildcard/2's syntax and dotfile rule (match_dot:), plustype:. No storage matches patterns itself, soFillists one directory level per segment, and the whole subtree once from a**on, the same on every adapter. (#40)Fil.exists?/3andFil.stat/3take the sametype:option, andFil.regular?/1,2checks for a file. On S3,Fil.regular?/1sends oneHEADandFil.dir?/1one listing, where a missing path took both before. The listing that checks for a directory now asks for two keys instead of reading the whole directory. (#40)Fil.Plugin.Validationrefuses writes by size (max_size:,min_size:), by content type (content_types:, checked against the content's magic bytes, so a GIF named.pngor HTML in a.txtfails, andimage/*doesn't take SVG) and by extension, plus acheck:of your own. A refused write returnsFil.InvalidContentErrorand writes nothing, and a stream fails as soon as it breaks a rule. Upload URLs are checked when they're signed, and a presigned S3 upload that would skip a content check is refused unlesspresigned_uploads: :check_declaredtrusts its signed content type. (#36)Fil.Op.scan_content/4andFil.Op.scan_result/4let a plugin read the content of a write or a read as it passes, without changing it. A stream keeps its chunks and its:size, so S3 still sends it in one request. A plugin refuses content by raising the newFil.InvalidContentErrorfrom a scan: the write returns the error and writes nothing, on every adapter, also when the scan raises after the last chunk.Fil.Pluganswers an upload refused this way with a413(too large), a415(content type or extension) or a422. (#33)Fil.read/3andFil.stream/3takeoffset:andlength:to read part of a file, on every adapter: S3 sends aRangeheader, the local disk reads from the offset, and the memory disk returns a sub-binary. Plugins that transform reads get the whole file andFilcuts the part from their result, so offsets count bytes of the content as you get it. (#35)Fil.Plugsendsetag,last-modifiedandaccept-ranges: bytes, answersif-none-matchandif-modified-sincewith a304, and aGETwith one byte range with a206(416for a range outside the file,if-rangehonoured). Several ranges get the whole file. Signed URLs work with ranges too, so browsers can seek in videos served from a local disk. (#35)- A tour of the API as a Livebook notebook, under Guides in the docs and linked from the README with a "Run in Livebook" badge. (#34)
Fil.LiveView.external/2lets the browser upload files straight to a disk, on every adapter: S3 with a presigned PUT, local and memory disks throughFil.Plug. The consume functions then check each file instead of writing it, and refuse one that's older than its upload URL or larger thanmax_file_size. The browser side is one import inapp.js,import {uploaders} from "phoenix-colocated/fil". (#26)Fil.signed_url/3takescontent_type:,size:andif_exists: :errorformethod: :put, and the upload has to match them, on S3 and throughFil.Plug: anothercontent-typeorcontent-lengthis a403, and withif_exists: :errorthe URL writes the file once and can't replace it. (#26)Fil.LiveView.upload_field/1is an upload field for LiveView forms, with drag and drop, previews, progress, cancel buttons, and remove buttons for the files the record already has. It's styled with daisyUI like the components Phoenix 1.8 generates, and a class attribute per part replaces the defaults.Fil.LiveView.cancel_upload/2handles its cancel buttons, andFil.LiveView.upload_error/2turns LiveView's and Fil's upload errors into{msgid, bindings}for the app'stranslate_error/1. The Phoenix guide shows a complete form. (#27)Fil.Ecto.Refstores refs in Ecto schemas: the column holds the path, and loading returns aFil.Refon the disk the field names.{:array, Fil.Ecto.Ref}holds several files in order, andFil.Ecto.Ref.removed/2returns the refs a changeset drops, to delete after the commit. A ref fits a field whenFil.Disk.same_storage?/2finds its disk on the same storage: the same adapter and the same address, which adapters return from the new optional callbackFil.Adapter.address/1(the root on a local disk, the endpoint, region, bucket and prefix on S3), so plugins and rotated credentials don't count. Ecto is a new optional dependency. (#25)Fil.LiveViewstores LiveView uploads on a disk:consume_uploaded_entries/4streams each file intoFil.write/4at a path you choose, and never replaces a file unless you passif_exists: :overwrite. If a write fails, it deletes the files it wrote and keeps the entries, so the form can be submitted again. It needs Phoenix LiveView 1.2, an optional dependency. The Phoenix guide walks through a form. (#23)Fil.Disk.resolve/1returns the disk for a disk, a 0-arity function or an MFA.Fil.Plug'sdisk:goes through it and raises anArgumentErrorwhen its function returns something other than a disk. It takes a function only as a capture such as&MyApp.Storage.uploads/0, because plug options can't hold an anonymous function. (#22)Fil.tmp/0,1creates a temporary directory and returns a ref to it, or to a file in it, on a local disk, so the whole API works on it. The directory belongs to the calling process and is removed when that process exits, also when it's killed.Fil.Tmp.path/1returns the path for tools that need one,Fil.Tmp.give_away/2hands the directory to another process, andFil.Tmp.cleanup/1removes it earlier. (#18)- A Fil disk smart cell for Livebook, which generates the
Fil.disk/1call for a Local, S3 or Memory disk, with the S3 credentials from Livebook secrets. It's there when Kino is installed. (#21) Fil.Kino.upload/3is a file field for Livebook that writes each upload to a directory of a disk, streamed from the file Livebook keeps.writable: trueonFil.Kino.browser/3adds it below the browser, together with a delete button for each file. (#20)Fil.Kino.browser/3browses a disk in Livebook: one directory at a time, with a preview of images and text and a download button. Kino is a new optional dependency. (#19)Fil.Plugin.Thumbnailswrites smaller copies of images when they're written, sized per variant, and deletes, copies and renames them with the image. They go underthumbnails/, or wherever a:variant_pathfunction puts them, such as next to the image.generate/1makes them later, withmode: :manualor for images stored before. It needs the optional Vix dependency. (#14)- Telemetry events for every operation on every disk,
[:fil, :op, :start],[:fil, :op, :stop]and[:fil, :op, :exception], with the operation, the disk, the path, the error and the bytes read or written. Each read of a stream fromFil.stream/3is a[:fil, :stream, ...]span of its own, with the bytes read. SeeFil.Telemetry. (#12) Fil.Telemetry.attach_default_logger/1logs every operation and every read of a stream, with its duration. (#12)- S3 uploads a stream without a size, a stream with
checksum:, and content over 5 GiB in parts (a multipart upload), with one part in memory at a time: 8 MiB by default, set with the new:part_sizeoption. A stream that fits in one part is still one PutObject. A part that fails because the storage is unavailable is sent once more, a second later. A failed upload is aborted, and so is the upload of a process that's killed. A:crc32checksum covers the whole file, however it's uploaded. A:sha256or:sha1checksum of an upload in parts covers each part, and S3 stores a checksum of those:Fil.stat/3returnsnilfor it, andverify_checksum: truechecks the content against it. (#11) Fil.stream/1,2,3andFil.stream!/1,2,3return a file's content as a stream of binaries, on every disk. They check the file right away and read it when the stream is enumerated. (#10)Fil.write/4takes a stream as well as iodata, and{:file, path}for a local file, such as thepathof aPlug.Upload. A stream that raises writes nothing. S3 sends a stream of known size as it's read, in one request, and uploads any other in parts.Filfinds the size of a local file, of aFile.Streamof bytes and of a stream fromFil.stream/3itself, and the newsize:option gives it for other streams.size: :unknownturns finding it off, for a file that grows while it's written (a log) or whose stat size may be wrong (/sys, network and FUSE file systems). (#10, #15, #38)Fil.Op.update_content/2andFil.Op.update_result/2take astream:function, which transforms a stream lazily, chunk by chunk or with state across chunks.op.streamingmarks a read fromFil.stream/3. A read transform that raises one ofFil's errors turns the read into that error. The plugins guide describes what a plugin can rely on. (#10)Fil.ConflictError: the file changed while the operation used it, so reading it again and retrying can help. A write of a stream whose sizeFilfound, and a copy across disks, return it when the file changes size meanwhile, and write nothing. S3 returns it when something else aborted an upload in parts.Fil.Pluganswers it with a409. (#10, #11, #15)stream/3is an optional adapter callback. Adapters without it stream the result ofread/3as one chunk. (#10)disposition:onFil.signed_url/3sets thecontent-dispositionof the download (:inline,:attachmentor{:attachment, filename}), on S3 asresponse-content-dispositionand on Local and Memory throughFil.Plug. (#1):public_endpointonFil.Adapter.S3builds public and signed URLs for a host other than the one the disk sends its requests to, such aslocalhostfor a container the application reaches by its service name. (#1)query:onFil.signed_url/3signs extra query parameters into the URL, e.g. for a page that reads them. (#1)
Changed
- A recursive
Fil.Adapter.ls/3returns the directories of the subtree too, at least every directory that holds a file, andFilleaves them out unless the caller asks withtype: :directory. Adapters of your own need to list them, ortype: :directoryandFil.wildcard/3patterns that match directories find nothing below the first level. (#40) Fil.LiveViewneeds Phoenix 1.8: the optional dependency is{:phoenix, "~> 1.8", optional: true}now, so an app with an older Phoenix can't resolvefilat all. The uploader for direct uploads is LiveView colocated JS, and LiveView 1.2 raises at compile time when a component with colocated JS compiles below Phoenix 1.8. (#26)content_type,sizeandif_existsare reserved names in thequery:option ofFil.signed_url/3, which raises for them like forexpiresordisposition. (#26)- S3's
InvalidRequesterror code is aFil.InvalidRequestErrorinstead of aFil.UnknownError. S3 sends it for a copy or a move of an object onto itself, for example.Fil.Plugstill answers it with a500and logs it, because S3 sends it for problems with the request or the bucket's configuration as well. (#16) Fil.Pluganswers an upload that the disk refuses for its content, aFil.InvalidRequestErrorthat isn't about the path, with a422instead of a404. (#14)Fil.write/4raisesArgumentErrorfor a list that isn't iodata, such as[70_000], before any plugin sees it. Before, a plugin that replaced the content or answered the call itself hid it. (#12)Fil.Op.update_content/2andupdate_result/2takeiodata:instead ofbinary:, which now raisesArgumentErrorlike any unknown transform. The function gets the same argument as before. (#10)Fil.Plugstreams uploads intoFil.write/4, with thecontent-lengthassize:, and sends downloads as a chunked response, so neither has to fit in memory. (#10)- A copy or a move across disks streams the file instead of reading it into memory, with the source's size, so S3 sends it in one request as it's read (in parts when a plugin on the source changes the content). (#10)
if_exists: :erroron a local disk writes to a temporary file and hard-links it into place, so a failed write no longer leaves a partial file behind. (#10)- Local writes name their temporary file
.fil-and a short suffix, which listings skip, so a name near the filesystem's limit works. A failed write also removes the directories it created. When the writing process is killed, its.fil-file and those directories are removed as well, as far as possible. (#10, #17) Fil.Plugrefuses a signed URL with a query parameter that wasn't signed, as S3 does. URLs signed by 0.1 still work. (#1)
Removed
- Elixir 1.16 and 1.17 are no longer supported; Fil needs Elixir 1.18 or later. (#15)
- OTP 26 and older are no longer supported; Fil needs OTP 27 or later, and supports the last three OTP releases. (#24)
chunk:inFil.Op.update_content/2andupdate_result/2: usestream:withStream.map/2. (#10)
Fixed
- A recursive
Fil.ls/3on S3 no longer returns directory markers (the empty objects whose key ends in/that consoles create for a folder) as files. (#40) Fil.Pluganswers403instead of500for signed URLs whose query parameters aren't plain strings. (#1)Fil.cp/3andFil.rename/3withif_exists: :errorreplaced an existing file within one disk, and refused only across disks. They now returnFil.AlreadyExistsErroron every adapter and leave both files as they were. The check is atomic: a hard link on local disk,:ets.insert_new/2in memory, andIf-None-Match: *on the CopyObject on S3. On local disk and in memory, a write that replaces the source during such a move stays, and the move fails with aFil.ConflictError. A move withoutif_exists: :errorin memory keeps that write too, like one on local disk. (#16)- A copy or a move on local disk that failed left behind the directories it created for the destination. It removes them now, like a write. (#16)
0.1.0 (2026-09-27)
Added
- First release.