S3FileSystemProvider
Namespace: Wisej.Ext.FileSystem
Assembly: Wisej.Ext.FileSystem.AmazonS3
Implementation of the Amazon S3 file system. Provides access to the S3 storage as a file system.
- C\\#
- VB.NET
public class S3FileSystemProvider : IFileSystemProvider
Public Class S3FileSystemProvider
Inherits IFileSystemProvider
Constructors
S3FileSystemProvider()
Initializes a blank instance of S3FileSystemProvider.
S3FileSystemProvider(root, name)
Creates a new instance of the S3FileSystemProvider class with the specified root and name . The root is added in front of all path arguments passed to all methods in this class.
| Name | Type | Description |
|---|---|---|
| root | String | The root path of this file system. |
| name | String | The name of this file system. |
The root path is also the current directory path.
Properties
AccessKey
String Returns or sets the S3 Access Key.
AccessSecret
String Returns or sets the S3 Access Secret string.
Icon
Image Returns or sets the icon that represents the file system.
IconSource
String Returns or sets the icon name or URL that represents the file system.
Name
String Returns or sets the name of this root. This is the name that should be shown to the user.
Root
String Returns or sets the root path for the file system. All file system operations in the implementation class are expected to be limited to the root.
For the S3 file system, the first name in the root path is the bucket name. i.e.: this.Root = "BUCKET_NAME\folder1\folder2";
Methods
Contains(path)
Checks whether the specified path starts with the Name of this file system provider.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the file to check. |
Returns: Boolean. True if the specified path starts with the name of this file system provider.
CreateDirectory(path)
Creates the specified directory and sub-directories.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the directory to create. |
DeleteDirectory(path, recursive)
Deletes the specified directory and, optionally, sub-directories.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the directory to delete. |
| recursive | Boolean | Indicates whether to delete sub directories. |
DeleteFile(path)
Deletes the specified file.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the file to delete. |
Exists(path)
Returns whether the specified file or directory exists.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the file or directory to check. |
Returns: Boolean. True of the file or directory exists.
GetAttributes(path)
Returns the FileAttributes for the specified path .
| Parameter | Type | Description |
|---|---|---|
| path | String | File path for which to retrieve the FileAttributes. |
Returns: FileAttributes. An instance of FileAttributes with the relevant flags set.
GetCreationTime(path)
Returns the file's creation time.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the file to query. |
Returns: DateTime. A DateTime representing the timestamp of the file creation.
The Amazon S3 file system only returns the LastModified date.
GetDirectories(path, pattern, searchOption)
Returns a list of directory paths that match the pattern and search options in the specified path.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path to search into. |
| pattern | String | Wild card pattern to match. |
| searchOption | SearchOption | One of the SearchOption options. |
Returns: String[]. A Array containing the full path of the directories that match the search pattern and search options.
GetFiles(path, pattern, searchOption)
Returns a list of file paths that match the pattern and search options in the specified path.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path to search into. |
| pattern | String | Wild card pattern to match. |
| searchOption | SearchOption | One of the SearchOption options. |
Returns: String[]. A Array containing the full path of the files that match the search pattern and search options.
GetFileSize(path)
Returns the size of the file.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the file to query. |
Returns: Int64.
GetLastWriteTime(path)
Returns the last write timestamp for the specified file.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the file to query. |
Returns: DateTime. A DateTime representing the timestamp of the last time the file was written.
MapPath(path)
Maps the virtual path to the corresponding physical path on the specific IFileSystemProvider implementation.
| Parameter | Type | Description |
|---|---|---|
| path | String | Virtual path to map to the corresponding physical path. |
Returns: String. The physical path for the IFileSystemProvider implementation.
OpenFileStream(path, mode, access)
Opens the specified file for reading or writing.
| Parameter | Type | Description |
|---|---|---|
| path | String | The path of the file to open. |
| mode | FileMode | Specified if the file should be opened, created, overwritten or truncated. |
| access | FileAccess | Specified if the stream should be opened for reading or writing. |
Returns: Stream. A Stream that can be used to read or write the content of the file.
RenameDirectory(path, newName)
Renames the specified directory.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the directory to rename. |
| newName | String | The new directory name. |
RenameFile(path, newName)
Renames the specified file.
| Parameter | Type | Description |
|---|---|---|
| path | String | Path of the file to rename. |
| newName | String | The new file name. |