HTML::O...OM::File(3)

πŸ“¦ version 0.6.0, in alpine 3.24

πŸ’– NAME πŸ’–

Ok bestie, this is the HTML::O...OM::File(3) manual page β€” User Contributed Perl Documentation, iykyk β€” and the actual class is HTML::Object::DOM::File, aka the HTML Object DOM File Class. Lowkey iconic. πŸ’…βœ¨


🌈 SYNOPSIS 🌈

use HTML::Object::DOM::File;
my $file = HTML::Object::DOM::File->new ||
    die( HTML::Object::DOM::File->error, "\n" );

πŸ¦‹ VERSION πŸ¦‹

v0.2.0 β€” that's the version, bestie. Highkey slay. πŸŽ€


🌸 DESCRIPTION 🌸

The File interface is literally the info desk for files: it gives you information about files and lets you access their content. Obsessed. It's giving file-info realness, fr fr. πŸ’–

Usually, File objects are retrieved from an HTML::Object::DOM::FileList object returned using the "<input"> files method.

It inherits from Module::Generic::File. Ngl, that's a nice little family tree. 🌳


🌈 PROPERTIES 🌈

Vibe check: every property down here is read-only, bestie. Don't try to write to them. πŸ’…

πŸ’– lastModified

Read-only.

Returns the last modified time of the file, in seconds since the UNIX epoch (January 1st, 1970 at Midnight), as a Module::Generic::DateTime object. The DateTime object stringifies to the seconds since epoch. The way that works is lowkey neat. ✨

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/File/lastModified

πŸ’œ lastModifiedDate

Read-only.

Returns the last modified date and time of the file referenced by the file object, as a Module::Generic::DateTime object.

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/File/lastModifiedDate

πŸŽ€ name

Read-only.

Returns the name of the file referenced by the file object.

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/File/name

πŸ¦‹ webkitRelativePath

Read-only.

Returns the relative file path.

Normally under JavaScript, this works alongside the "<input"> attribute webkitdirectory:

<input type="file" webkitdirectory />

...allowing a user to select an entire directory instead of just files. So, webkitRelativePath provides the relative file path to that directory uploaded. Cute, right? 🫢

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath

πŸ“ size

Read-only.

Returns the size of the file in bytes.

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/File/size

⭐ type

Read-only.

Returns the MIME type of the file, or undef if it cannot find it.

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/File/type


πŸ”₯ METHODS πŸ”₯

🧚 arrayBuffer

Opens the file as "raw" data and returns its content as a scalar object.

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Blob/arrayBuffer

πŸ‘‘ slice

Provided with a start and an end as a range, and an optional encoding, this returns that range of data from the file as a scalar object. If no encoding is provided, this will default to utf-8.

If you specify a negative start, it is treated as an offset from the end of the file's data toward the beginning. For example, -10 would be the "10th" from last byte in the file data. The default value is 0. If you specify a value for start that is larger than the size of the file, the returned scalar object has size 0 and contains no data.

The end specifies the offset (not the length) of the last byte, without including it, to include in the returned data. If you specify a negative end, it is treated as an offset from the end of the data toward the beginning. For example, -10 would be the "10th" from last byte in the file's data. The default value is the file size, i.e. until the end of the file's data.

Returns a new scalar object containing the data in the specified range of bytes of the file. Not me double-checking that end is an offset and not a length πŸ˜­πŸ’€

🌈 stream

This opens the file and returns its file handle to read the file's contents. You could also do:

my $io = $file->open || die( $file->error );

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream

🌟 text

Opens the file in utf-8 and returns its content as a scalar object.

See Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Blob/text


πŸ‘‘ AUTHOR πŸ‘‘

Jacques Deguest <jack@deguest.jp> β€” iconic author behavior, fr fr. πŸ’…


πŸ’« SEE ALSO πŸ’«

Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/File


Copyright(c) 2021 DEGUEST Pte. Ltd.

All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Catch you later, bestie πŸ’– β€” this HTML::O...OM::File(3) page is from perl v5.42.2, dated 2026-02-15. Slay! πŸŽ€βœ¨

πŸ“¦ where this page comes from