dimohy
1
Stowage๋ IFileStorage
๋ผ๋ ์ถ์ํ ์ธํฐํ์ด์ค๋ก ๊ฐ ์คํ ๋ฆฌ์ง๋ฅผ ์๋ฆ๋ต๊ฒ ์ถ์ํ ํฉ๋๋ค.
์ฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
using (IFileStorage fileStorage = Files.Of.{storage_provider}(string arg1,...))
{
await fileStorage.{action_method};
}
์๋ฅผ ๋ค์ด Azure Blob Storage
์์ IFileStorage
๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
var fileStorage = Files.Of.AzureBlobStorage(string "{account}", string "{key}");
2 Likes
dimohy
2
๊ฐ๋จํ๊ฒ ๋ฉ๋ชจ๋ฆฌ ์คํ ๋ฆฌ์ง๋ฅผ ๋ง๋ค์ด์ ํ
์คํธ ํด๋ณด์์ต๋๋ค.
์ฑ๋ฅ ํ๊ฐ๋ ํด๋ด์ผ ๊ฒ ์ง๋ง ์ผ๋จ ์ธํฐํ์ด์ค๊ฐ ๊ฐ๋จํด์ ์ข๋ค์.
Storage.Net์ ๋ง๋์ ๋ถ์ด๋ผ ๋ฏฟ์์ด ๊ฐ๋๋ค.
using Stowage;
using System.Text;
Console.WriteLine("Storage Test");
using var ms = Files.Of.InternalMemory();
await ms.WriteText(@"test/test.txt", "test", Encoding.UTF8);
//var list = await fs.Ls();
//foreach (var item in list)
//{
// Console.WriteLine(item.Name);
// using var fss = await fs.OpenRead(item.Path);
// using var mss = await ms.OpenWrite(item.Path, WriteMode.CreateNew);
// await fss.CopyToAsync(mss);
//}
foreach (var item in await ms.Ls(recurse: true))
{
Console.WriteLine(item);
}
var text = await ms.ReadText("test/test.txt", Encoding.UTF8);
Console.WriteLine($"Read Text: {text}");
await ms.Rm("/test/", recurse: true);
foreach (var item in await ms.Ls(recurse: true))
{
Console.WriteLine(item);
}
| ๊ฒฐ๊ณผ
Storage Test
/test/test.txt
/test/
Read Text: test
2 Likes
์คโฆ ์ด๊ฑด ์ข์๋ณด์ด๋ค์โฆ!
์ฌ๋ฌ ํ๋ซํผ์์ ์์กด์ฑ์ ๋ฒ์ด๋์ผ ํ ๊ฒฝ์ฐ ๊ณ ๋ คํด๋ณผ ์ ์์๋งํ ๊ฒ ๊ฐ์์!
3 Likes