faker.providers.file.en_US
¶
Package Contents¶
Classes¶
Implement default file provider for Faker. |
|
Implement default file provider for Faker. |
- class faker.providers.file.en_US.FileProvider(generator: Any)¶
Bases:
faker.providers.BaseProvider
Implement default file provider for Faker.
- application_mime_types: faker.providers.ElementsType[str] = ('application/atom+xml', 'application/ecmascript', 'application/EDI-X12', 'application/EDIFACT',...¶
- audio_mime_types: faker.providers.ElementsType[str] = ('audio/basic', 'audio/L24', 'audio/mp4', 'audio/mpeg', 'audio/ogg', 'audio/vorbis',...¶
- image_mime_types: faker.providers.ElementsType[str] = ('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/svg+xml', 'image/tiff',...¶
- message_mime_types: faker.providers.ElementsType[str] = ('message/http', 'message/imdn+xml', 'message/partial', 'message/rfc822')¶
- model_mime_types: faker.providers.ElementsType[str] = ('model/example', 'model/iges', 'model/mesh', 'model/vrml', 'model/x3d+binary',...¶
- multipart_mime_types: faker.providers.ElementsType[str] = ('multipart/mixed', 'multipart/alternative', 'multipart/related', 'multipart/form-data',...¶
- text_mime_types: faker.providers.ElementsType[str] = ('text/cmd', 'text/css', 'text/csv', 'text/html', 'text/javascript', 'text/plain', 'text/vcard',...¶
- video_mime_types: faker.providers.ElementsType[str] = ('video/mpeg', 'video/mp4', 'video/ogg', 'video/quicktime', 'video/webm', 'video/x-matroska',...¶
- image_file_extensions: faker.providers.ElementsType[str] = ('bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff')¶
- text_file_extensions: faker.providers.ElementsType[str] = ('css', 'csv', 'html', 'js', 'json', 'txt')¶
- office_file_extensions: faker.providers.ElementsType[str] = ('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'pages', 'numbers', 'key', 'pdf')¶
- mime_type(category: Optional[str] = None) str ¶
Generate a mime type under the specified
category
.If
category
isNone
, a random category will be used. The list of valid categories include'application'
,'audio'
,'image'
,'message'
,'model'
,'multipart'
,'text'
, and'video'
.- Sample
- Sample
category=’application’
- file_name(category: Optional[str] = None, extension: Optional[str] = None) str ¶
Generate a random file name with extension.
If
extension
isNone
, a random extension will be created under the hood using |file_extension| with the specifiedcategory
. If a value forextension
is provided, the value will be used instead, andcategory
will be ignored. The actual name part itself is generated using |word|.- Sample
size=10
- Sample
category=’audio’
- Sample
extension=’abcdef’
- Sample
category=’audio’, extension=’abcdef’
- file_extension(category: Optional[str] = None) str ¶
Generate a file extension under the specified
category
.If
category
isNone
, a random category will be used. The list of valid categories include:'audio'
,'image'
,'office'
,'text'
, and'video'
.- Sample
- Sample
category=’image’
- file_path(depth: int = 1, category: Optional[str] = None, extension: Optional[str] = None, absolute: Optional[bool] = True) str ¶
Generate an pathname to a file.
This method uses |file_name| under the hood to generate the file name itself, and
depth
controls the depth of the directory path, and |word| is used under the hood to generate the different directory names.If
absolute
isTrue
(default), the generated path starts with/
and is absolute. Otherwise, the generated path is relative.- Sample
size=10
- Sample
depth=3
- Sample
depth=5, category=’video’
- Sample
depth=5, category=’video’, extension=’abcdef’
- unix_device(prefix: Optional[str] = None) str ¶
Generate a Unix device file name.
If
prefix
isNone
, a random prefix will be used. The list of valid prefixes include:'sd'
,'vd'
, and'xvd'
.- Sample
- Sample
prefix=’mmcblk’
- unix_partition(prefix: Optional[str] = None) str ¶
Generate a Unix partition name.
This method uses |unix_device| under the hood to create a device file name with the specified
prefix
.- Sample
- Sample
prefix=’mmcblk’
- class faker.providers.file.en_US.Provider(generator: Any)¶
Bases:
faker.providers.file.Provider
Implement default file provider for Faker.